HomePhabricator

Fix two-hop interwiki prefix lookup reducing "foo.org" to "org"

Authored by thiemowmde on Sep 16 2020, 8:48 AM.

Description

Fix two-hop interwiki prefix lookup reducing "foo.org" to "org"

As the code was arranged before, this could happen:

  • Let's say an import is not done from de.wikinews.org but from wikinews.org.
  • The code would reduce it to "org" and look for a match in the local interwiki table, obviously finding one, because there is a lot that ends with "org". Let's say it matches wiktionary.org.
  • It continues to ask wiktionary.org if it knows wikinews.org. If it does, we end with "wiktionary:wikinews". This actually works (!), but is really weird.

Introduced in I89aab93.

This is not a problem in production. We don't have many source
wikis that don't have a sub-domain. The few we have are most
certainly resolved earlier via getPrefixFromInterwikiTable(),
and never reach the code touched in this patch. And even if,
it would still be a working interwiki prefix. Just a weird one.

Bug: T225515
Change-Id: Ibf139f5db310dcbee8f40a32668dcb906b3cf7bb

Details