Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6fab573

Browse files
committedApr 9, 2021
fix: do not crash on unescaped svg data uri
1 parent dcce860 commit 6fab573

File tree

3 files changed

+55
-9
lines changed

3 files changed

+55
-9
lines changed
 

‎src/utils.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,24 @@ function normalizeUrl(url, isStringValue) {
9898
}
9999

100100
if (matchNativeWin32Path.test(url)) {
101-
return decodeURI(normalizedUrl);
101+
try {
102+
normalizedUrl = decodeURI(normalizedUrl);
103+
} catch (error) {
104+
// Ignore
105+
}
106+
107+
return normalizedUrl;
108+
}
109+
110+
normalizedUrl = unescape(normalizedUrl);
111+
112+
try {
113+
normalizedUrl = decodeURI(normalizedUrl);
114+
} catch (error) {
115+
// Ignore
102116
}
103117

104-
return decodeURI(unescape(normalizedUrl));
118+
return normalizedUrl;
105119
}
106120

107121
function requestify(url, rootContext) {

0 commit comments

Comments
 (0)
Please sign in to comment.