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.

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.

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'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.