Use escape instead of encodeURI and encodeURIComponent, so that problematic filename characters are escaped correctly

pull/315/head
Chris Brown 2016-06-06 15:35:12 +01:00
rodzic 5cad3449c3
commit 0dc707ec65
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -193,12 +193,13 @@ define(function(require, exports, module) {
extraPaths = path;
path = path[0];
extraPaths = "," + extraPaths.map(function(p) {
return p[0] == path[0] && p != path ? encodeURI(p).replace(/,/g, "%2C") : "";
return p[0] == path[0] && p != path ? escape(p) : "";
}).filter(Boolean).join(",");
}
window.open(vfsUrl(path) + extraPaths
+ "?download"
+ (filename ? "=" + encodeURIComponent(filename) : "")
// Escape '+', otherwise it gets interpreted as a space.
+ (filename ? "=" + escape(filename) : "").replace(/\+/g, "%2B")
+ (isfile ? "&isfile=1" : ""));
}