Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
Master
-
- 7.4-known-issues
- 7.4.13-u56
- liferay-ga37-ce-743-known-issues
- liferay-ga38-ce-743-known-issues
- liferay-ga39-ce-743-known-issues
- liferay-ga40-ce-743-known-issues
- liferay-ga41-ce-743-known-issues
- liferay-ga42-ce-743-known-issues
- liferay-ga43-ce-743-known-issues
- liferay-ga44-ce-743-known-issues
- liferay-ga45-ce-743-known-issues
- liferay-ga46-ce-743-known-issues
- liferay-ga47-ce-743-known-issues
- liferay-ga48-ce-743-known-issues
- liferay-ga49-ce-743-known-issues
- liferay-ga50-ce-743-known-issues
- liferay-ga51-ce-743-known-issues
- liferay-ga52-ce-743-known-issues
- liferay-ga53-ce-743-known-issues
- liferay-ga54-ce-743-known-issues
- liferay-ga55-ce-743-known-issues
- liferay-ga56-ce-743-known-issues
Description
In tracing a failure that was not being logged (see https://issues.liferay.com/browse/LPS-159225), we were able to determine that a DuplicateFileNameException was being thrown when trying to upload the file.
In reviewing DDMUserPersonalFolderUploadFileEntryHandler class where the DuplicateFileNameException was being generated, we can see an attempt to generate a unique filename for the current upload in https://github.com/liferay/liferay-portal/blob/master/modules/apps/dynamic-data-mapping/dynamic-data-mapping-form-web/src/main/java/com/liferay/dynamic/data/mapping/form/web/internal/upload/DDMUserPersonalFolderUploadFileEntryHandler.java#L84-L87
As can be seen in this call, the _exists() method is being called passing in the scope group ID, folder ID and filename to the method. The _exists() method will look for a file in the repository id for the group id, and the folder and the filename. If it finds an existing file, _exists() returns true, otherwise it returns false.
Unfortunately this causes a problem because the repository id is being passed into the upload portlet request, see https://github.com/liferay/liferay-portal/blob/master/modules/apps/dynamic-data-mapping/dynamic-data-mapping-form-web/src/main/java/com/liferay/dynamic/data/mapping/form/web/internal/upload/DDMUserPersonalFolderUploadFileEntryHandler.java#L82-L83
And this repository id is used in the addFileEntry() call to store the file, see https://github.com/liferay/liferay-portal/blob/master/modules/apps/dynamic-data-mapping/dynamic-data-mapping-form-web/src/main/java/com/liferay/dynamic/data/mapping/form/web/internal/upload/DDMUserPersonalFolderUploadFileEntryHandler.java#L89-L95
Because the _exists() method is given the scope group id, the repository id the system uses to determine if the file exists is actually different than the repository id used to add the file.
So _exists() returns false for a filename that has already been uploaded because it doesn't find the file in the alternate location, but when the addFileEntry() is called with the different repository id, it tries then to upload using a duplicate filename and throws the DuplicateFilenameException and fails.
Steps to reproduce:
1. Create a form that includes a document upload.
2. Complete the form and upload any file such as "readme.txt".
3. Complete the form and re-upload the same file.
Expected result: The 2nd upload would rename the file as "readme (2).txt" and the upload would be successful.
Actual result: The 2nd upload fails, the UI shows a generic "your request failed message", there's nothing in the logs to indicate the failure and you're prevented from completing the form.
This is a problem since different users will not know what filenames have been used by others during uploads and there is a high probability that there will be filename conflicts during the upload.
Attachments
Issue Links
- mentioned in
-
Page Loading...