Skip to content

Commit 4f289c5

Browse files
fix: do not crash on unescaped svg data uri (#1288)
1 parent dcce860 commit 4f289c5

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)