From ccac0258af9b6d8c93d41b1f170e20dbf2efe3f3 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sat, 1 Jul 2017 12:39:25 +0100 Subject: [PATCH] Apply URL decoding in download saver document.location gives us an URL encoded version of the original filename, so we decode it to recover the original filename for saving. Fixes #2828 Fixes #2819 --- core/modules/savers/download.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/modules/savers/download.js b/core/modules/savers/download.js index 0f6e09296..3f5740dcd 100644 --- a/core/modules/savers/download.js +++ b/core/modules/savers/download.js @@ -25,7 +25,8 @@ DownloadSaver.prototype.save = function(text,method,callback,options) { if(!filename) { var p = document.location.pathname.lastIndexOf("/"); if(p !== -1) { - filename = document.location.pathname.substr(p+1); + // We decode the pathname because document.location is URL encoded by the browser + filename = decodeURIComponent(document.location.pathname.substr(p+1)); } } if(!filename) {