Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-12945

getDirectory() fails on Windows 10 for paths ending in "/"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Master
    • None
    • cordova-plugin-file
    • None

    Description

      The getDirectory() method of FileProxy.js used by cordova-plugin-file on Windows 10 attempts to split the provided path into a containing folder and a final path segment. When the provided path ends in a "/", getDirectory() considers the final path segment to be "" (the empty string), causing an exception.

      See the split into `name` and `wpath` here: https://github.com/apache/cordova-plugin-file/blob/master/src/windows/FileProxy.js#L758.

      For instance, if we pass in the path "foo/bar/", getDirectory() will try to get the folder "" under the folder "foo/bar". The request for "foo/bar" succeeds, as one would expect, but the attempt to then read "' beneath it fails, since "" is not a valid directory name.

      From our testing, final "/" in directory paths works without failure on both Android and iOS.

      getDirectory() should remove any final "/" before splitting the path into `name` and `wpath` components.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              adam.haile@gmail.com Adam Haile
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: