resvg icon indicating copy to clipboard operation
resvg copied to clipboard

URL-encoded URLs not decoded

Open jaskij opened this issue 1 month ago • 2 comments

While investigating why KiCAD's project icon is not rendering properly in some renders I discovered that resvg is one of the renderers in question.

The culprit seems to be in line 650

style="fill:url(#%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B9_%D0%B3%D1%80%D0%B0%D0%B4%D0%B8%D0%B5%D0%BD%D1%82_10);stroke-width:1" />

After running the argument to url() through URL decoding, we get #Безымянный_градиент_10, and Безымянный_градиент_10 is a gradient present on line 456.

I'm not deep enough into various W3C specs to say for sure if that should be decoded, but I think it should. Chromium (whatever it uses for SVG), Thunar (qt6-svg, I think) and Inkscape render the file correctly, while rsvg seems to have the exact same issue. Firefox too, but I think it uses rsvg?

jaskij avatar Nov 22 '25 13:11 jaskij

Strange. Old versions of Firefox supported this "feature", but the latest one (145) does not. So it either got broken or removed/disabled.

Since only Chrome renders it correctly, it's probably an undefined SVG feature. Especially since the file was created by Inkscape, which does not care about the spec much.

TL;DR: probably safe to assume that this is a malformed file.

RazrFalcon avatar Dec 01 '25 19:12 RazrFalcon

Oh, absolutely, and the file was fixed. Just wanted to draw your attention to this, in case it was a bug in resvg.

jaskij avatar Dec 01 '25 22:12 jaskij