From 0dc707ec6556bad9e64f6f20a0f4fcd2be9f1227 Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Mon, 6 Jun 2016 15:35:12 +0100 Subject: [PATCH] Use escape instead of encodeURI and encodeURIComponent, so that problematic filename characters are escaped correctly --- plugins/c9.vfs.client/vfs_client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/c9.vfs.client/vfs_client.js b/plugins/c9.vfs.client/vfs_client.js index eade1caf..51d7736c 100644 --- a/plugins/c9.vfs.client/vfs_client.js +++ b/plugins/c9.vfs.client/vfs_client.js @@ -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" : "")); }