linebender / resvg

An SVG rendering library.
Apache License 2.0
2.84k stars 229 forks source link

`usvg` fails to parse SVGs if `xmlns` attribute is missing #847

Open nicoburns opened 1 week ago

nicoburns commented 1 week ago

usvg will currently fail to parse otherwise valid SVGs is the xmlns attribute is missing. This is the correct behaviour for standalone SVG files, but not correct for "inline SVGs" embedded within HTML documents.

As such, I would like to propose that an option is added to usvg::Options that determines whether the namespace should check is enabled.

I would be able to create a PR for this.

RazrFalcon commented 1 week ago

Are you sure this is the correct behaviour? Browsers would not open such files. Meanwhile Inkscape, librsvg and QtSvg are fine. And I'm not sure how easy it would be to implement this. Adding an option is definitely not the way. It should be handled automatically.

Overall, it's a super rare edge case we can simply ignore.