Page MenuHomePhabricator

Validate SVG content
Closed, ResolvedPublic

Description

Author: wikimedia.org

Description:
Wikipedia has 16655 pieces of SVG content now (
http://en.wikipedia.org/w/index.php?title=Special:Search&search=.svg&fulltext=Search&ns6=1&offset=0&limit=100
)

I bet you quite a bit of that content is not really SVG, valid by the W3C standard.
Please put some QA in place to make all content valid, as otherwise you are
breaking the standard, something that Wikipedia as a proponent of free and easy
exchange of information can't have.

Openclipart.org has recently started a project like that on which you can build:
http://openclipart.org/wiki/SVG_Testing
Please also help that project improve


Version: unspecified
Severity: enhancement

Details

Reference
bz7645

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:24 PM
bzimport set Reference to bz7645.

ayg wrote:

It should be simple to use XMLReader::isValid() for this on upload time, if it
exists (installed by default with PHP 5.1). The question is what to do if it's
not, outright reject it? We accept invalid HTML for pages, we just clean it up.

http://us2.php.net/manual/en/ref.xmlreader.php

wikimedia.org wrote:

  • Does that XMLreader know how to handle 'extra' namespaces? = For example: A significant part of SVG content on the web has been created

with Inkscape of which the default

Save results in application specific information being added to the document
  • There's more Quality Assurance than just marking something valid or invalid: = errors could have suggestions with it, for example:
    1. "viewbox" not allowed, "viewBox" allowed though = valid content can still get suggestions for improvement:
    2. you don't have a viewBox, but you specify a fixed width and height; your

graphic will be more scalable by

  setting width and height to 100% and the viewBox to 0,0,width,height"
# you use commas in viewBox, replacing them with spaces makes ASV3* correctly

interpret the attribute

*:Adobe SVG Viewer 3, a deprecated but still significantly used viewer

I just added a link to the source in CVS of the earlier mentioned
openclipart.org SVG validation tools

wikimedia.org wrote:

And with testing the 3rd random thing claiming to be SVG i hit an error:
http://upload.wikimedia.org/wikipedia/en/7/7b/Chebyshev.svg
(not showing an image on Firefox, usually that means not having the right
MIME-type or namespace)

wikimedia.org wrote:

http://upload.wikimedia.org/wikipedia/en/9/9c/Che.svg has path elements with
empty d attributes, which is strange to the very least and probably wrong.

brion added a comment.Aug 3 2009, 4:53 PM

Assigning SVG bugs to Ariel -- need a cleanup pass to see what's fixed up by a librsvg upgrade, what can be resolved with fixes to our font configuration, what can be fixed on our end, and what still needs to be pushed upstream.

TheDJ added a comment.Nov 4 2010, 3:40 AM

Seems implemented using XmlTypeCheck atm.

Old files might need re-assesment, which is bugzilla:7645

(In reply to comment #6)

Seems implemented using XmlTypeCheck atm.

Old files might need re-assesment, which is bugzilla:7645

XmlTypeCheck only checks that the root element is correct (and in the right namespace), and that the xml document is well formed. It doesn't validate that it really is an svg document. (although its unclear from the original request if a well formed-ness check is sufficient).

Gilles moved this task from Untriaged to Done on the Multimedia board.