Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Master
-
None
-
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
- duplicates
-
CB-12930 File plugin getDirectory on windows fails on path ending with slash
- Open