Page MenuHomePhabricator

SVGCheck gives "Not an SVG" error in both IE and Chrome
Closed, ResolvedPublic

Description

When using Jarry1250's SVGCheck (http://tools.wmflabs.org/svgcheck/) in Chrome or IE, perfectly valid SVGs return the error "That file doesn't appear to be an SVG file." Trying the same files in Firefox works fine.


Version: unspecified
Severity: normal
OS: Windows 7
Platform: PC

Details

Reference
bz73470

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:46 AM
bzimport set Reference to bz73470.
Trlkly created this task.Nov 15 2014, 1:32 PM

Wikimedia User Perhelion has mentioned a possible alternate mime-type for SVGs which might help: image/svg. Or maybe just look at how Wikimedia determines mime-types, as the files work fine there.

I wish I could find a way to test what my Chrome configuration is choosing as the mime-type for SVG files.

I do note that Perhelion is not running into the same problems I am having, so I'll add more information. Chrome 38.0.2125.111 on Windows 7 Home Premium SP1.

Trlkly added a comment.Dec 9 2014, 4:06 AM

Okay, I tracked down the issue. It seems that an installation of Inkscape set the mimetype of SVG files to "application/svg" in the registry. Changing it to "image/svg+xml" fixed the problem.

That said, I don't think this bug should be closed. There's a potential security issue in accepting a MIME type that the user can set themselves. The file server on Wikimedia handles this differently, as it did not have problems with the local mimetype.

Until that is done, I would suggest a quick fix of testing for the other common SVG MIME-types of "application/svg" and "image/svg". You might also consider "text/svg." Users should not need to edit their registry to get a tool like this to work.

I'm sure this is part of why http://commons.wikimedia.org/wiki/File:Test.svg is so popular.

I can reproduce this beavior now and reported it to Inkscape: http://bugs.launchpad.net/inkscape/+bug/1402309

Jarry1250 closed this task as Resolved.Oct 7 2017, 4:22 PM

I've belatedly expanded the list of accepted mime-types in https://github.com/Jarry1250/labs-svgcheck/commit/729c5f69

From a security perspective, the script doesn't rely on the mimetype. It's just there to help users make sure they uploaded the right file.

I see, helpfully, that the Inkscape bug was fixed in 2015.