Skip to content

Commit

Permalink
fix: do not crash on unescaped svg data uri
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 9, 2021
1 parent dcce860 commit 6fab573
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
18 changes: 16 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,24 @@ function normalizeUrl(url, isStringValue) {
}

if (matchNativeWin32Path.test(url)) {
return decodeURI(normalizedUrl);
try {
normalizedUrl = decodeURI(normalizedUrl);
} catch (error) {
// Ignore
}

return normalizedUrl;
}

normalizedUrl = unescape(normalizedUrl);

try {
normalizedUrl = decodeURI(normalizedUrl);
} catch (error) {
// Ignore
}

return decodeURI(unescape(normalizedUrl));
return normalizedUrl;
}

function requestify(url, rootContext) {
Expand Down
Loading

0 comments on commit 6fab573

Please sign in to comment.