mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 16:54:52 +00:00
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:
committed by
GitHub
parent
650275fdf5
commit
7afd23665f
+4
-1
@@ -124,7 +124,10 @@ export function SvgXml(props: XmlProps) {
|
|||||||
|
|
||||||
export async function fetchText(uri: string) {
|
export async function fetchText(uri: string) {
|
||||||
const response = await fetch(uri);
|
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) {
|
export function SvgUri(props: UriProps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user