GNOME Bugzilla – Bug 771769
In a svg file the stylesheet is not used if located in the parent directory
Last modified: 2017-12-13 18:24:21 UTC
Dear developers. Consider this SVG image that references a stylesheet in its parent directory. The stylesheet is not taken into account while it is if one moves in the image directory. (eog 3.20.4, debian strech) [e.svg] <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="../stroke.css" charset="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" id="e" viewBox="-600 0 1000 1000"> <g transform="matrix(1 0 0 -1 0 600)"> <path d="M 72,42 c 53,20 88,52 88,88"/> <path d="M 160,130 a 50,50 0 0 1 -50,50 a 70,70 0 0 1 -70,-70 a 90,90 0 0 1 90,-90"/> <path d="M 130,20 a 100,100 0 0 1 60,20"/> </g> </svg> [stroke.css] path { fill:none; stroke:#36c; stroke-width:40; stroke-linecap:round; } Regards, Philippe
I think the librsvg devs have to decide about that as it appears to be on purpose. The thing is that eog sets the SVG basepath to the path of the SVG. When loading external resources librsvg (which handles SVGs for eog) makes some security checks. One such check appears to be enforcing that file resources have the basepath as prefix, which means that loading of "../stroke.css" will be denied while "./stroke.css" or "sub/stroke.css" would work.
Thank you for this analysis and clear explanation. Excuse me stress. I do it because the gene is significant. Also, the rfc3987 requires accepting this path. Q1? The Security check seems to be paranoid delirium: can someone explain? Q2? Can you change this behavior in the librsvg API call? Q3? Is it worth opening a librsvg bug? If so, would you do it?
I'm sorry, I did not see that the bug was reassigned to librsvg. Q1?, and Q2? are.
(In reply to Pecita from comment #2) > Q2? Can you change this behavior in the librsvg API call? No, the API only let's me set the base URI.
This bug creates a problem of general consistency with other libraries. If for example I imports the svg in FontForge, FF relies on libraries respecting the specification, applies the stylesheet and creates an object that conforms to user expectation, different from eog. librsvg can not make a such decision alone. (May be eog could use an other librarie than librsvg?)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/154.