Skip to content

Commit

Permalink
Don't fail on plain string SVG after svg#486
Browse files Browse the repository at this point in the history
  • Loading branch information
GreLI committed Feb 7, 2016
1 parent 4e9daae commit 7b99430
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/svgo/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ exports.encodeSVGDatauri = function(str, type) {
* @return {String} output string
*/
exports.decodeSVGDatauri = function(str) {

var regexp = /data:image\/svg\+xml(;charset=[^;,]*)?(;base64)?,(.*)/;
var match = regexp.exec(str);

// plain string
if (!match) return str;

var data = match[3];

// base64
Expand All @@ -64,7 +67,6 @@ exports.decodeSVGDatauri = function(str) {
}

return str;

};

exports.intersectArrays = function(a, b) {
Expand Down

0 comments on commit 7b99430

Please sign in to comment.