Page MenuHomePhabricator

FileImport does not work with foreign file namespaces
Closed, ResolvedPublic

Description

What happens:
When trying to import a file from a wiki project that uses different namespace identifiers for files, the importer gets confused about the colon character in the filename.

e.g. Try to import https://de.wikipedia.org/wiki/Datei:Barmbek.png

You will get The title you are currently trying to import to contains invalid filename characters. warning with Datei:Barmbek.png in the filename input field

Expected behavior:
Autodetect the foreign file namespace and remove it from the title.

Event Timeline

Also note, that in this case he keeps the file extension also as part of the filename input field.

Change 363588 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/FileImporter@master] Fix ApiDetailRetriever for foreign file namespaces

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

Change 363588 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Fix ApiDetailRetriever for foreign file namespaces

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

There seems to be a remaining issue with importing files from foreign namespaces. Steps to reproduce:

  • import a file from a foreign namspace without changes e.g. https://fr.wikipedia.org/wiki/Fichier:Terredesfemmes.png
  • now try to click the link where the file should be moved to e.g. File:Terredesfemmes.png
  • the file will not be there
  • try to import the same file again
  • the importer will complain that the file already exists with following link File:Fichier:Terredesfemmes.png

You see, that the foreign namespace (Fichier:) became a part of the new file title.

Change 366239 had a related patch set uploaded (by WMDE-Fisch; owner: WMDE-Fisch):
[mediawiki/extensions/FileImporter@master] Remove foreign NS when importing file

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

Change 366239 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Remove foreign NS when importing file

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