Description of problem:
1. When creating an Uploaded file in Project Authoring perspective, it is possible to input name containing spaces (which is a valid one). However BaseUploadServlet probably doesn't escape URI-illegal characters in the file name when creating git path URI and so fails with java.net.URISyntaxException.
2. The same problem occurs when downloading contents of Uploaded file asset with spaces in name. In this case java.net.URISyntaxException originates from FileDownloadServlet.
The errors above have no visible UI response, exception stack trace is printed into server log.
3. When renaming/copying Uploaded file and typing a new name with spaces, error dialog pops up with the following message:
Unable to complete your request. The following exception occurred: java.lang.StringIndexOutOfBoundsException:String index out of range: -1.
There are no further details in server.log.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create new Uploaded file in Project Authoring perspective.
2. Use name containing a space, e.g. "My File".
3. Select ~any~ existing file on local file system (not a .txt file).
4. Hit Ok to submit upload dialog, check server log, check Other section in Project Explorer.
5. Create Uploaded file without spaces in name, upload any file.
6. Clone the repository, rename the file to "My File", commit and push changes.
7. Open "My File" in Business Central.
8. Hit Download, check server.log.
9. Create Uploaded file without spaces in name, upload any file.
10. Try to rename or copy the file using new name with a space.
- Steps 4. & 8. java.net.URISyntaxException in server log.
- Step 10. Error dialog with java.lang.StringIndexOutOfBoundsException:String index out of range: -1.
Business Central should be able to handle Uploaded file assets with spaces in name when uploading, downloading renaming or copying.
Created attachment 1002888 [details]
Created attachment 1002889 [details]
the following commits fixes the issue:
Walter, thanks for fix. Plus point for written tests. Great job.
There was only small problem. File "a b c.xyz" was downloaded as "a.xyz". This PR should fix it:
Verified on 6.2.0.ER5.