Page MenuHomePhabricator

FileImporter, importing https://commons.wikimedia.org/wiki/File:30th_Street_at_5th_Avenue_-_Stra%C3%9Fe_in_New_York.jpg fails
Closed, ResolvedPublic

Description

From the security review:

Trying to import https://commons.wikimedia.org/wiki/File:30th_Street_at_5th_Avenue_-_Stra%C3%9Fe_in_New_York.jpg fails. I think it may be related to the original revision of the file being AWOL. Should be some more options than just failing (badly) like this below

[4e4f1c377fe077133b676185] /wiki/Special:ImportFile FileImporter\Exceptions\HttpRequestException from line 111 of /vagrant/mediawiki/extensions/FileImporter/src/Services/Http/HttpRequestExecutor.php:

Backtrace:

#0 /vagrant/mediawiki/extensions/FileImporter/src/Services/Http/HttpRequestExecutor.php(78): FileImporter\Services\Http\HttpRequestExecutor->executeWithCallback(string, array)
#1 /vagrant/mediawiki/extensions/FileImporter/src/Operations/FileRevisionFromRemoteUrl.php(76): FileImporter\Services\Http\HttpRequestExecutor->executeAndSave(string, string)
#2 /vagrant/mediawiki/extensions/FileImporter/src/Data/ImportOperations.php(47): FileImporter\Operations\FileRevisionFromRemoteUrl->prepare()
#3 /vagrant/mediawiki/extensions/FileImporter/src/Services/Importer.php(104): FileImporter\Data\ImportOperations->prepare()
#4 /vagrant/mediawiki/extensions/FileImporter/src/SpecialImportFile.php(227): FileImporter\Services\Importer->import(User, FileImporter\Data\ImportPlan)
#5 /vagrant/mediawiki/extensions/FileImporter/src/SpecialImportFile.php(133): FileImporter\SpecialImportFile->doImport(FileImporter\Data\ImportPlan)
#6 /vagrant/mediawiki/includes/specialpage/SpecialPage.php(522): FileImporter\SpecialImportFile->execute(NULL)
#7 /vagrant/mediawiki/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL)
#8 /vagrant/mediawiki/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
#9 /vagrant/mediawiki/includes/MediaWiki.php(851): MediaWiki->performRequest()
#10 /vagrant/mediawiki/includes/MediaWiki.php(523): MediaWiki->main()
#11 /vagrant/mediawiki/index.php(43): MediaWiki->run()
#12 /var/www/w/index.php(5): include(string)
#13 {main}

And reproducible on our test system

[10c8291d42c3daefb7dc9703] /wiki/index.php/Special:ImportFile FileImporter\Exceptions\HttpRequestException from line 111 of /var/www/html/wiki/extensions/FileImporter/src/Services/Http/HttpRequestExecutor.php:

Backtrace:

#0 /var/www/html/wiki/extensions/FileImporter/src/Services/Http/HttpRequestExecutor.php(78): FileImporter\Services\Http\HttpRequestExecutor->executeWithCallback(string, array)
#1 /var/www/html/wiki/extensions/FileImporter/src/Operations/FileRevisionFromRemoteUrl.php(76): FileImporter\Services\Http\HttpRequestExecutor->executeAndSave(string, string)
#2 /var/www/html/wiki/extensions/FileImporter/src/Data/ImportOperations.php(47): FileImporter\Operations\FileRevisionFromRemoteUrl->prepare()
#3 /var/www/html/wiki/extensions/FileImporter/src/Services/Importer.php(111): FileImporter\Data\ImportOperations->prepare()
#4 /var/www/html/wiki/extensions/FileImporter/src/SpecialImportFile.php(227): FileImporter\Services\Importer->import(User, FileImporter\Data\ImportPlan)
#5 /var/www/html/wiki/extensions/FileImporter/src/SpecialImportFile.php(133): FileImporter\SpecialImportFile->doImport(FileImporter\Data\ImportPlan)
#6 /var/www/html/wiki/includes/specialpage/SpecialPage.php(522): FileImporter\SpecialImportFile->execute(NULL)
#7 /var/www/html/wiki/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL)
#8 /var/www/html/wiki/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
#9 /var/www/html/wiki/includes/MediaWiki.php(851): MediaWiki->performRequest()
#10 /var/www/html/wiki/includes/MediaWiki.php(523): MediaWiki->main()
#11 /var/www/html/wiki/index.php(43): MediaWiki->run()
#12 {main}

Reason for failure: Missing original for old version of the file (which also means it can't be thumbnailed)

Bildschirmfoto 2017-11-07 um 16.37.58.png (333×463 px, 61 KB)

Event Timeline

It would appear that for the file revision where the image itself is missing, an invalid url is returned in the request data rather than leaving the url blank: https://upload.wikimedia.org/wikipedia/commons/archive/a/a7/. I think this is the reason why it fails badly.

Sounds like that should be fixed in core somehow, that is super ugly...
Would you mind filing a ticket?
I guess it should either return a blank url field or no url field at all (or something) but not such a broken URL.

I wonder how many such cases there are.

Change 403179 had a related patch set uploaded (by Andrew-WMDE; owner: Andrew-WMDE):
[mediawiki/extensions/FileImporter@master] Handle file revisions that contain a missing image file

https://gerrit.wikimedia.org/r/403179

Change 403179 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Handle file revisions that contain a missing image file

https://gerrit.wikimedia.org/r/403179

WMDE-Fisch claimed this task.
WMDE-Fisch removed WMDE-Fisch as the assignee of this task.
WMDE-Fisch moved this task from Todo to Done on the WMDE-TechWish board.
WMDE-Fisch moved this task from Sprint Backlog to Done on the WMDE-QWERTY-Sprint-2018-01-23 board.