linebender / linebender/resvg

URL-encoded URLs not decoded

Open
#978 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.1k
Forks
348
Avg merge
1d 14h
Merged PRs (30d)
3

Description

While investigating why [KiCAD's project icon is not rendering properly in some renders](https://gitlab.com/kicad/code/kicad/-/blob/332b4ed1078a2c06d3be08d2f737d1a57e764c07/resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-project.svg) I discovered that resvg *is* one of the renderers in question.

The culprit seems to be in [line 650](https://gitlab.com/kicad/code/kicad/-/blob/332b4ed1078a2c06d3be08d2f737d1a57e764c07/resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-project.svg)
```
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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the KiCAD SVG linked in the report, especially the fill URL on line 650 and the matching gradient on line 456. Trace resvg's handling of the percent-encoded fragment in url(), then verify that the SVG renders its project icon correctly when the fragment identifies that gradient.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.