Kozea / Kozea/CairoSVG

urllib.error.URLError when running svg2png on SVGs containing internal xlink:hrefs

Open
#245 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
951
Forks
166
PR merge metrics
No merged PRs in 30d

Description

Hello, I've found other references (https://github.com/Kozea/CairoSVG/issues/134) to this issue, but I'm still having trouble processing SVGs containing internal xlink:hrefs with CairoSVG 2.4.0.

Here's a general idea of my SVG structure:
```

```

I'm calling CairoSVG from a python script with this code:
`cairosvg.svg2png(url='svgs/' + svgName, write_to='svgs/png.png', scale=2)`

When I run my code on SVGs that don't contain internal hrefs everything processes as expected, but when I try to run my code on an SVG with internal hrefs I receive the following error:
`urllib.error.URLError: `

How can I fix this behavior so CairoSVG will properly parse internal hrefs?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided SVG and the cairosvg.svg2png(url=..., write_to=..., scale=2) entry point. Trace how the internal xlink:href value #arrows is resolved on Windows, especially the conversion to a file URL. Done means SVGs with internal hrefs render successfully without attempting to open a %23arrows file.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.