mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-25 03:53:31 +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) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user