Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-611

FilenameUtils.normalize does not sanitize multiple slashes after prefix

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6
    • 2.12.0
    • None
    • None

    Description

      FilenameUtils.#normalize states in javadoc that //foo//./bar becomes /foo/bar

      System.out.println(FilenameUtils.normalize("//foo//./bar"));
      System.out.println(FilenameUtils.normalize("\\\\foo\\\\.\\bar"));
      

      Result:

      //foo//bar
      //foo//bar
      

      So, javadoc says, that it should be /foo/bar. I think, that //foo is prefix, so it should be //foo/bar. But in real life it becomes the third way (//foo//bar).

       

      I think we should fix javadoc and the code. The correct result should be //foo/bar

      Attachments

        Activity

          People

            Unassigned Unassigned
            urvanov Urvanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h