Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-165

filename not properly parsed for windows file server paths with struts running on a linux box

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 Beta 1
    • Fix Version/s: 1.0.0
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Operating System: Linux
      Platform: PC
    • Bugzilla Id:
      1624

      Description

      Configuration is: the struts-upload example with a windows machine client and a
      linux machine server. Upload a file from a remote fileserver and note that the
      filename is the entire path.

      Looking at the code in MultipartIterator.getNextElement(), it handles the fact
      that filenames are not parsed properly in linux jdks, but does not special case
      file server paths (eg \\foo\bar\file.mov). It assumes the windows filepath
      will have a ":" - needs to also check for "
      " - something like:

      //check for windows filenames,
      //from linux jdk's the entire filepath
      //isn't parsed correctly from File.getName()
      int colonIndex = filename.indexOf(":");
      int slashSlashIndex = filename.indexOf("\\\\");
      int slashIndex = filename.lastIndexOf("
      ");

      if ((colonIndex > -1 || slashSlashIndex > -1) && (slashIndex > -1))

      { //then consider this filename to be a full //windows filepath, and parse it accordingly //to retrieve just the file name filename = filename.substring(slashIndex+1, filename.length()); }

        Attachments

          Activity

            People

            • Assignee:
              mschachter@bluestone.com Mike Schachter
              Reporter:
              jeff_schindler@theprairie.com Jeff Schindler
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: