From 95f2af09ff9ca09a0ad00ff55e6cd5b8ce7c55bd Mon Sep 17 00:00:00 2001 From: cjn <1229412289@qq.com> Date: Thu, 23 Aug 2018 14:17:40 +0800 Subject: [PATCH] solve bug #150 fixed: https://github.com/exupero/saveSvgAsPng/issues/150 --- src/saveSvgAsPng.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/saveSvgAsPng.js b/src/saveSvgAsPng.js index 41a36d6..6595059 100644 --- a/src/saveSvgAsPng.js +++ b/src/saveSvgAsPng.js @@ -278,7 +278,9 @@ out$.svgAsDataUri = (el, options, done) => { requireDomNode(el); const result = out$.prepareSvg(el, options) - .then(({src}) => `data:image/svg+xml;base64,${window.btoa(reEncode(doctype+src))}`); + .then(({src}) =>{ + src = src.replace(/(]+)>/, "$1 >"); + return `data:image/svg+xml;base64,${window.btoa(reEncode(doctype+src))}`}); if (typeof done === 'function') return result.then(done); return result; };