Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 592febc

Browse files
Change to using encodeURIComponent, but without encoding '/'.
1 parent d66e4e0 commit 592febc

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

src/file/FileUtils.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ define(function (require, exports, module) {
3939
Dialogs = require("widgets/Dialogs"),
4040
DefaultDialogs = require("widgets/DefaultDialogs"),
4141
Strings = require("strings"),
42-
StringUtils = require("utils/StringUtils");
42+
StringUtils = require("utils/StringUtils"),
43+
_ = require("thirdparty/lodash");
4344

4445

4546
/**
@@ -516,19 +517,12 @@ define(function (require, exports, module) {
516517
}
517518

518519
function encodeFilePath(path) {
519-
path = encodeURI(path);
520-
path = path.replace(/#/g, '%23');
521-
path = path.replace(/\$/g, '%24');
522-
path = path.replace(/&/g, '%26');
523-
path = path.replace(/\+/g, '%2B');
524-
path = path.replace(/,/g, '%2C');
525-
path = path.replace(/\//g, '%2F');
526-
path = path.replace(/:/g, '%3A');
527-
path = path.replace(/;/g, '%3B');
528-
path = path.replace(/=/g, '%3D');
529-
path = path.replace(/\?/g, '%3F');
530-
path = path.replace(/@/g, '%40');
531-
return path;
520+
var pathArray = path.split("/");
521+
var encodedPath = [];
522+
_.forEach(pathArray, function(subPath, index) {
523+
encodedPath[index] = encodeURIComponent(subPath);
524+
});
525+
return encodedPath.join("/");
532526
}
533527

534528
// Define public API

0 commit comments

Comments
 (0)