Fix for SvgUri and SvgCssUri crashing on non-existing svg files (#1503)

Fix for interpreting an HTML error response as svg data, and then crash when this cannot be parsed as well formed XML
This commit is contained in:
Sjaak Schilperoort
2022-03-04 15:38:33 +01:00
committed by GitHub
parent 650275fdf5
commit 7afd23665f
+4 -1
View File
@@ -124,7 +124,10 @@ export function SvgXml(props: XmlProps) {
export async function fetchText(uri: string) {
const response = await fetch(uri);
return await response.text();
if (response.ok) {
return await response.text();
}
throw new Error(`Fetching ${uri} failed with status ${response.status}`);
}
export function SvgUri(props: UriProps) {