Page MenuHomePhabricator

Older version with broken svg content resulted in undecipherable error message during Import
Open, Needs TriagePublic


I tried to move en:File:Arbeiderpartiet 2008 results.svg to Commons using the FileExporter/FileImporter beta feature. The preview page opened fine, but when I tried to import the file it generated an error:

Internal error

[XGwgcApAMFAAAEfEWo0AAACV] 2019-02-19 15:27:46: Fatal exception of type "RuntimeException"

Steps to reproduce:

  1. Enable the FileExporter beta feature on enwiki
  2. Navigate to
  3. Click the "Export to Wikimedia Commons" button (sometimes in the More dropdown in Vector)
  4. Click "Import" at the bottom of the page that opens (Special:ImportFile)
  5. Observe the error

I have not been able to reproduce this error outside of this file, but it occurred multiple times with this file.

Event Timeline

Restricted Application added a project: TCB-Team. · View Herald TranscriptFeb 19 2019, 3:37 PM
Failed to validate operations.
#0 /srv/mediawiki/php-1.33.0-wmf.17/extensions/FileImporter/src/Services/Importer.php(171): FileImporter\Services\Importer->validateImportOperations(FileImporter\Data\ImportOperations)
#1 /srv/mediawiki/php-1.33.0-wmf.17/extensions/FileImporter/src/Services/Importer.php(119): FileImporter\Services\Importer->importInternal(User, FileImporter\Data\ImportPlan)
#2 /srv/mediawiki/php-1.33.0-wmf.17/extensions/FileImporter/src/SpecialImportFile.php(291): FileImporter\Services\Importer->import(User, FileImporter\Data\ImportPlan)
#3 /srv/mediawiki/php-1.33.0-wmf.17/extensions/FileImporter/src/SpecialImportFile.php(181): FileImporter\SpecialImportFile->doImport(FileImporter\Data\ImportPlan)
#4 /srv/mediawiki/php-1.33.0-wmf.17/includes/specialpage/SpecialPage.php(569): FileImporter\SpecialImportFile->execute(NULL)
#5 /srv/mediawiki/php-1.33.0-wmf.17/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(NULL)
#6 /srv/mediawiki/php-1.33.0-wmf.17/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#7 /srv/mediawiki/php-1.33.0-wmf.17/includes/MediaWiki.php(867): MediaWiki->performRequest()
#8 /srv/mediawiki/php-1.33.0-wmf.17/includes/MediaWiki.php(517): MediaWiki->main()
#9 /srv/mediawiki/php-1.33.0-wmf.17/index.php(42): MediaWiki->run()
#10 /srv/mediawiki/w/index.php(3): require(string)
#11 {main}
Pikne added a subscriber: Pikne.Mar 12 2019, 10:37 AM

This SVG file seems to be invalid. My browser displays its XML tree instead of image, and is unable to check it.

Possibly it relates to T218083, in case there is some sort of discrepancy between file extension and the actual content.

Pikne added a comment.EditedMar 19 2019, 8:10 PM

I now ran into another SVG that gives this error:
W3C validator doesn't like the version of this SVG, but I've imported several other SVG-s of the same version successfully.

Edit: I now notice that older versions of this SVG are invalid. This and cases where older versions are with non-matching file extension (issue mentioned above) make me wonder whether it would be an option to run that kind of checks only on the latest version?

Lea_WMDE renamed this task from Importing File:Arbeiderpartiet 2008 results.svg to Commons results in an error to Older version with non-matching file ending resulted in undecipherable error message during Import.May 15 2019, 12:24 PM
Pikne added a comment.May 28 2019, 7:20 AM

File name endings of both SVG files mentioned in this task seem to be correct and intended, but there is apparently something wrong with file content, and both the latest version (first SVG has one version) and older versions are checked. Also, it doesen't seem to be related to abuse filters.

Lea_WMDE renamed this task from Older version with non-matching file ending resulted in undecipherable error message during Import to Older version with broken svg content resulted in undecipherable error message during Import.Jun 11 2019, 2:52 PM

Now that more specific error messages are exposed to users, it says "Cannot upload SVG files that contain a non-standard DTD declaration.". Currently there doesn't seem to be much else to do with such files than: 1) upload fixed version to source wiki, 2) delete the file, 3) restore only the valid file version, 4) import. Which feels counter-productive as file history will be lost.

I'm still wondering if this check and possibly some other checks (like the one for non-matching file extension mentioned above) can be skipped for either old file versions or maybe all versions. This defective content is there in Wikimedia environment already anyway. So I would say not much of new harm would be done. Individual files just need to be fixed and it'd be nice if file history can be preserved properly. If certain checks were run on only the latest version then this would hopefully ensure that problems were fixed before importing and file would need no further attention on Commons. Would it be technically possible or otherwise an option?