Page MenuHomePhabricator

Already prefixed wikilinks may get duplicate prefixes like [[:de:de:…]]
Open, Needs TriagePublic

Description

When the source wiki is the German Wikipedia, and the file description contains a self-link like

[[:de:S-Bahn Mitteldeutschland|S-Bahn Mitteldeutschland]]

… the replacement becomes

[[:w:de:de:S-Bahn Mitteldeutschland|S-Bahn Mitteldeutschland]]

These links work just fine, but clutter the wikitext a bit. Possible solutions and workarounds I can think of at the moment:

  • Before adding any prefix to a link, check if a prefix exists (e.g. de:). If it represents the source wiki itself, remove it.
  • After adding all prefixes, "implode" duplicates. E.g. de:de: becomes de:. Note this is technically a hack as it assumes all prefixes do have the same meaning on (possibly) different wikis. However:
    • This replicates what a user would do.
    • To my knowledge it should work 100% of the time on the Wikimedia cluster.
  • …?

Example diff: https://commons.wikimedia.org/wiki/Special:Diff/364855386

Details

Related Gerrit Patches:
mediawiki/extensions/FileImporter : master[WIP] Avoid duplicating link prefix pointing to source wiki
mediawiki/extensions/FileImporter : masterFix WikiLinkPrefixer duplicating multi-part prefixes

Event Timeline

As this is mainly cosmetic and everything is working as expected (e.g. the link is resolved correctly), we consider this not important for the small-default milestone.

Change 538638 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] [WIP] Avoid duplicating link prefix pointing to source wiki

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

Change 539884 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Fix WikiLinkPrefixer duplicating multi-part prefixes

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

Change 539884 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Fix WikiLinkPrefixer duplicating multi-part prefixes

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