IUploadFile implementations should be prepared for "all" file name-separator 
characters in getFileName()
--------------------------------------------------------------------------------------------------------

                 Key: TAPESTRY-1227
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1227
             Project: Tapestry
          Issue Type: Bug
          Components: Core
    Affects Versions: 4.1.2
         Environment: linux server, windows client
            Reporter: Norbert Sándor
            Priority: Critical


I use the Upload component to allow files to be uploaded by users, and I have 
the following problem when the server and the client runs different OSs.
1. the file to be uploaded is selected in the browser on windows (eg. 
C:\Képek\image.jpg)
2. the file is uploaded
3. the application running on linux calls IUploadFile.getFileName() and gets 
"C:\Képek\image.jpg" instead of the expected "image.jpg"

The problem is with UploadPart.getFileName():

    public String getFileName()
    {
        File file = new File(this.getFilePath());

        return file.getName();
    }

In this implementation File.getName() will use the OS's name-separator 
character ('/' in my case) but the uploaded file contains other characters 
('\\') instead.

If I manually edit the path of the selected file in the file browser field from 
"C:\Képek\image.jpg" to "C:/Képek/image.jpg" before hitting the upload button, 
the upload process works fine (and luckily it seems that Windows eats '/' 
separators as well :) ). But of course this should be handled automatically.

Probably the same problem should be handled in IUploadFile.getFilePath() as 
well.

What do you think?

Regards:
Norbi

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to