Closed
Description
Bug
I'm using SvgUri
like
<SvgUri
width="60"
height="60"
uri="https://mydomain.com/images/logo.svg"
/>
and I'm getting following error
there is element in SVG file
<polygon fill="#FF4422" points="37.16667,56.13386 47.16667,56.13386 47.16667,81.13386 62.16665,81.13386 62.16665,56.13386 		72.16666,56.13386 72.16666,41.13386 37.16667,41.13386 	"/>
and issue causes following escape format sequences
, 	
I've tried to put this string directly to Polygon
elements and it unescaped those sequences automatically and render just fine. Also, my SVG renders in a browser without any issue.
<Polygon
points="37.16667,56.13386 47.16667,56.13386 47.16667,81.13386 62.16665,81.13386 62.16665,56.13386 		72.16666,56.13386 72.16666,41.13386 37.16667,41.13386 	"
fill="#FF4422"
/>
I see solution as add
.replace(/&#.+?;/g, '')
to unescape fetched string. I think best place is
// src/xml.tsx
function getAttributes(props: {
[x: string]: Styles | string | number | boolean | undefined;
style?: string | Styles | undefined;
}) {
while (i < length) {
// ...
// ----- fix starts
if (typeof value === "string") {
value = String(value).replace(/&#.+?;/g, '');
}
// ----- fix ends
props[camelCase(name)] = value;
}
}
I can make PR. Please let me know what do you think.