https://commons.wikimedia.org/wiki/File:DFO_Logo.svg was parsed incorrectly by MediaWiki because its height was specified as a decimal without a leading zero and in non-pixel units. .417118in is a valid height value in SVG per W3C validator and works in librsvg 2.40.18, Inkscape, Firefox, and Chromium.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
SVG: SVG unit parser support for wider range of number | mediawiki/core | master | +46 -1 |
Related Objects
Event Timeline
@Aklapper I assume @Hello71 is referring to the first version of the file, where the height is specified as .417118in (that first version doesn't render). The current file's height is 1.0594797cm. I think librsvg might have some issues with handling decimal points with no leading zeroes, as I've run into similar issues with the stroke-dasharray attribute.
@Aklapper I've reuploaded the original file with the only difference being that the file height is now 0.417118in. The file now works.
@Jc86035 It could also be an issue with the SVG metadata parser of MediaWiki.
This looks suspicious: https://gerrit.wikimedia.org/g/mediawiki/core/+/master/includes/media/SVGMetadataExtractor.php#383
though the fallback i guess would create incorrect data, not so much cause missing data perhaps...
Phab copied it from the parent ticket.
Well in this case, the value is .417118in, so it will be entered as .417118px, which is presumably rounded to 0 somewhere else.
I uploaded https://commons.wikimedia.org/wiki/File:DFO_Logo_2x_size_test.svg with a height of .834236in to test, and it does in fact display a height of 1 pixel and also render a one pixel tall preview.
So the official SVG spec indicates it should be something more in the order of:
/^\s*([-+]?\d*(?:\.\d+|\d+)(?:[Ee][-+]?\d+)?)\s*(em|ex|px|pt|pc|cm|mm|in|%|)\s*$/
https://www.w3.org/TR/SVG/types.html#DataTypeLength
https://www.w3.org/TR/SVG/types.html#DataTypeNumber
Change 451092 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/core@master] SVG: SVG unit parser support for wider range of number
Change 451092 merged by jenkins-bot:
[mediawiki/core@master] SVG: SVG unit parser support for wider range of number