Skip to content

Commit 2132bbf

Browse files
committed
CB-10577: Windows resolveLocalFileSystemURL should omit trailing slash for file
1 parent 3e09b31 commit 2132bbf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

www/FileEntry.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ var utils = require('cordova/utils'),
3636
* {FileSystem} filesystem on which the file resides (readonly)
3737
*/
3838
var FileEntry = function(name, fullPath, fileSystem, nativeURL) {
39-
FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath, fileSystem, nativeURL]);
39+
// remove trailing slash if it is present
40+
if (fullPath && /\/$/.test(fullPath)) {
41+
fullPath = fullPath.substring(0, fullPath.length - 1);
42+
}
43+
if (nativeURL && /\/$/.test(nativeURL)) {
44+
nativeURL = nativeURL.substring(0, nativeURL.length - 1);
45+
}
46+
47+
FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath, fileSystem, nativeURL]);
4048
};
4149

4250
utils.extend(FileEntry, Entry);

0 commit comments

Comments
 (0)