Tapestry
  1. Tapestry
  2. TAPESTRY-1227

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.2
    • Component/s: tapestry-core
    • Labels:
      None
    • Environment:
      linux server, windows client

      Description

      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

        Activity

        Norbert Sándor created issue -
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Fix Version/s 4.1.2 [ 12312202 ]
        Hide
        Jesse Kuhnert added a comment -

        Done.. The IUpload.getFilePath() has to remain the same though, as a file path indicates the full path string + file name. The documentation for this one makes it clear already that the paths will change depending on the client platform so I'm ok with this.

        Show
        Jesse Kuhnert added a comment - Done.. The IUpload.getFilePath() has to remain the same though, as a file path indicates the full path string + file name. The documentation for this one makes it clear already that the paths will change depending on the client platform so I'm ok with this.
        Jesse Kuhnert made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Assignee Jesse Kuhnert [ jkuhnert ]
        Mark Thomas made changes -
        Workflow jira [ 12394033 ] Default workflow, editable Closed status [ 12569232 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569232 ] jira [ 12592135 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        34d 16h 29m 1 Jesse Kuhnert 15/Feb/07 00:40

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Norbert Sándor
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development