From d98f3f1dcac1c2f43613e515cde53713dd89bf7f Mon Sep 17 00:00:00 2001 From: Abhishek Reddy Date: Thu, 5 Oct 2017 19:50:23 +1300 Subject: [PATCH] Fix SVG download URL resolution for IE/Edge --- src/snapshot/filesaver.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/snapshot/filesaver.js b/src/snapshot/filesaver.js index 88109ffe7dd..667bc0c01d1 100644 --- a/src/snapshot/filesaver.js +++ b/src/snapshot/filesaver.js @@ -53,7 +53,11 @@ var fileSaver = function(url, name) { // IE 10+ (native saveAs) if(typeof navigator !== 'undefined' && navigator.msSaveBlob) { - navigator.msSaveBlob(new Blob([url]), name); + // At this point we are only dealing with a SVG encoded as + // a data URL (since IE only supports SVG) + var encoded = url.split(/^data:image\/svg\+xml,/)[1]; + var svg = decodeURIComponent(encoded); + navigator.msSaveBlob(new Blob([svg]), name); resolve(name); }