Skip to content

Commit

Permalink
fix: do not crash on unescaped svg data uri (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 9, 2021
1 parent dcce860 commit 4f289c5
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
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

0 comments on commit 4f289c5

Please sign in to comment.