Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Invalid
-
1.1.1
-
None
-
None
Description
The filename extracted from the content disposition may contain a full path (i.e. as submitted by the Internet Explorer for example).
It's is important to check for this and strip the path information accordingly as the upload fails if you use FileItem#getName() to build your destination path.
I patched the abstract class FileUploadBase#getFileName(...) with a few lines of code inspired by COS' MultiPartParser
Starting on line 447 (after fileName = fileName.trim(); )
// The filename may contain a full path. Cut to just the filename.
int slash = Math.max(fileName.lastIndexOf('/'), fileName.lastIndexOf('
')); // check for Unix AND Win separator
if (slash > -1)
Attachments
Issue Links
- duplicates
-
FILEUPLOAD-17 [fileupload] FileItem.getName() returns filename plus path from Windows/IE
- Closed
- relates to
-
FILEUPLOAD-235 FileItem.getName() does not conform to the Java File.getName behaviour and *returns* a full path when provided with one
- Reopened