You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Adam Haile (JIRA)" <ji...@apache.org> on 2017/06/23 03:13:00 UTC

[jira] [Created] (CB-12945) getDirectory() fails on Windows 10 for paths ending in "/"

Adam Haile created CB-12945:
-------------------------------

             Summary: getDirectory() fails on Windows 10 for paths ending in "/"
                 Key: CB-12945
                 URL: https://issues.apache.org/jira/browse/CB-12945
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-file
    Affects Versions: Master
            Reporter: Adam Haile


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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org