mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:53:44 +08:00
fix: remove comments from svg icons to prevent front-end crashes. fixer #2093
This commit is contained in:
parent
825b00e618
commit
dfefcf03ad
@ -64,10 +64,15 @@ export const TestViewer = forwardRef<TestViewerRef, Props>((props, ref) => {
|
|||||||
try {
|
try {
|
||||||
if (!form.name) throw new Error("`Name` should not be null");
|
if (!form.name) throw new Error("`Name` should not be null");
|
||||||
if (!form.url) throw new Error("`Url` should not be null");
|
if (!form.url) throw new Error("`Url` should not be null");
|
||||||
|
|
||||||
let newList;
|
let newList;
|
||||||
let uid;
|
let uid;
|
||||||
|
|
||||||
if (form.icon && form.icon.startsWith("<svg")) {
|
if (form.icon && form.icon.startsWith("<svg")) {
|
||||||
|
// 移除 icon 中的注释
|
||||||
|
if (form.icon) {
|
||||||
|
form.icon = form.icon.replace(/<!--[\s\S]*?-->/g, "");
|
||||||
|
}
|
||||||
const doc = new DOMParser().parseFromString(
|
const doc = new DOMParser().parseFromString(
|
||||||
form.icon,
|
form.icon,
|
||||||
"image/svg+xml",
|
"image/svg+xml",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user