Page MenuHomePhabricator

Thumbnails of certain SVG files fail to render
Open, Needs TriagePublic


Hi, some of our users have complained that thumbnails of SVGs created in inkscape are failing to render on the file page (if they click the link to view the image on our static domain it works.

For example this image

I've tried to follow but that didn't help (didn't fix the problem). So im thinking this bug is in mediawiki/core.

I see "(Invalid SVG file: Expected <svg> tag, got in NS )"

Event Timeline

Paladox created this task.Jul 16 2018, 6:27 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 16 2018, 6:27 PM

I don't see any SVG failing to render here, just PNG thumbnails of an SVG file that don't get rendered?

(Why are all these people subscribed to this task???)

"(Invalid SVG file: Expected <svg> tag, got in NS )" looks wrong as the SVG file itself starts with the line <svg xmlns="" width="695.757" height="518.598">.
The first version of that file also worked as expected I guess as only the newer versions state "Dimensions: 0 × 0".

Restricted Application added projects: Commons, Multimedia. · View Herald TranscriptJul 17 2018, 10:49 AM
Aklapper renamed this task from SVG's created in inkscape fail to render to Thumbnail of a specific SVG fails to render.Jul 18 2018, 9:08 AM
Aklapper updated the task description. (Show Details)

I am the original user who filed the initial complaint of this issue on Miraheze's Phabricator. The original report is here alongside several other files that encountered the issues (PNG thumbnails of SVG files failing to render). Here is the list of all files presented from that report:

File:Coat of arms of Cancun.svg (Altverse Miraheze - File page with the error)
File:Coat of arms of Cancun.svg (Altverse Miraheze - Static version showing no error)
File:Coat of arms of Cancun.svg (Wikia version for comparison -- uploaded after original file was put on Miraheze) (The file being used as an example in this report) (This file has previous versions where there were no issues until the most recent upload) (This image was created over 3 years ago) (This is the oldest image on the wiki which encounters this problem--uploaded on June 17, the same day Miraheze updated with the latest version of MediaWiki [1.31])

Centrist16 renamed this task from Thumbnail of a specific SVG fails to render to Thumbnails of certain SVG files fail to render.Jul 28 2018, 5:51 PM
saper added a subscriber: saper.Aug 2 2018, 12:04 AM

Change 449915 had a related patch set uploaded (by saper; owner: saper):
[mediawiki/core@master] SVGMetaDataExtractorTest: Additional test cases

saper added a comment.EditedAug 2 2018, 12:52 AM

@Paladox can you try to apply and run phpunit on your MW instance:

env LC_MESSAGES=C LANG=C LC_TIME=C  php tests/phpunit/phpunit.php \
--configuration tests/phpunit/suite.xml \
--exclude-group Broken,Stub,Dump,ParserFuzz --log-junit /tmp/log.xml \

and see if it passes? It seems to work for me with git master as of 49dda2dc7c87f8acf09541803d8f581b7f8b70c7

Paladox added a comment.EditedAug 2 2018, 12:59 AM

I get this error:

[99acb0f0404380e43c1e3e73] [no req] MWException from line 476 of /srv/mediawiki/w/includes/cache/localisation/LocalisationCache.php: No localisation cache found for English. Please run maintenance/rebuildLocalisationCache.php.

Yet i have run that.

@saper did you test that against stretch?

Legoktm removed a subscriber: Legoktm.Aug 2 2018, 1:08 AM
saper added a comment.Aug 2 2018, 2:26 AM

@Paladox no, only some oldish Gentoo for now.

I think i found the problem. It is because of wgSVGMetadataCutoff.

When i set that higher the problem goes away.

saper added a comment.Aug 5 2018, 7:54 PM

Okay, but why? Do we need to read a whole SVG as XML to figure it out? In this case this option is useless. On the other hand, I cannot reproduce this with a unit test.