Skip to content
Snippets Groups Projects
Commit 46f5f671 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Handle icons not returning valid svg

In case we get a html response because of our http fallback just return
the error icon instead.
parent 96861d29
No related branches found
No related tags found
No related merge requests found
......@@ -45,8 +45,10 @@ async function getSVGTextElement(name) {
return unsafeHTML(errorIcon);
}
let text = await response.text();
if (text.indexOf('<svg') !== -1)
text = text.slice(text.indexOf('<svg'));
if (text.indexOf('<svg') === -1) {
return unsafeHTML(errorIcon);
}
text = text.slice(text.indexOf('<svg'));
return unsafeHTML(text);
}
......@@ -86,10 +88,8 @@ class Icon extends LitElement {
render() {
let svg = getSVGTextElement(this.name);
let placeholder = unsafeHTML('<svg></svg>');
return html`
${until(svg, placeholder)}
${until(svg)}
`;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment