Page MenuHomePhabricator

Alternative URL for some languages have encoded quote marks
Open, In Progress, MediumPublicBUG REPORT

Description

When you look at the HTML of /view/ pages like https://www.wikifunctions.org/view/en/Z10001, the alternative URLs for some languages have encoded quote marks around the language code.
e.g. <link rel="alternate" hreflang="&quot;swh&quot;" href="/view/&quot;swh&quot;/Z10001">

Seems like the affected languages are (in order of HTML appearance)

  • swh
  • gaz
  • uzn
  • be-x-old
  • gya
  • abq-latn
  • zh-yue
  • ory
  • sr-me
  • khk
  • plt
  • pbt
  • npi
  • lvs
  • dik
  • kmr
  • taq-tfng

The same thing also happens on Beta e.g. https://wikifunctions.beta.wmflabs.org/view/en/Z10004

Event Timeline

Nintendofan885 changed the subtype of this task from "Task" to "Bug Report".Jul 31 2023, 9:44 PM

This sounds like they've been persisted into the DB as 'swh' rather than swh etc., which was a bug in our code briefly during development but fixed a few weeks ago. Though it's possible this might have persisted to Beta, it certainly shouldn't have happened in production, and definitely not only some of the time.

I can write a quick patch to detect this situation and de-quote it, but something's going wrong with the insertion somewhere.

Aha, this is for secondary language codes. Whoops.

Jdforrester-WMF changed the task status from Open to In Progress.Aug 1 2023, 1:00 PM
Jdforrester-WMF claimed this task.
Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF moved this task from To triage to In Progress on the Abstract Wikipedia team board.

Change 944215 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] ZObjectSecondaryDataUpdate: Add language secondary labels as strings not ZStrings

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

Change 944215 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] ZObjectSecondaryDataUpdate: Add language secondary labels as strings not ZStrings

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

OK, now the next step is to clear the cache and trigger insertZLanguageToLanguagesCache() for those languages. But I'm not going to do that in production on a Friday whilst I'm at Wikimania. :-)

Checked view-source:https://www.wikifunctions.org/view/en/Z10001 in wikifunctions wmf.28
Seems that the following lang still have the issue (much shorter list than reported in the task description):
hreflang="&quot;gaz&quot;" href="/view/&quot;gaz&quot;/Z10001">
hreflang="&quot;sr-me&quot;" href="/view/&quot;sr-me&quot;/Z10001">
hreflang="&quot;khk&quot;" href="/view/&quot;khk&quot;/Z10001">
hreflang="&quot;npi&quot;" href="/view/&quot;npi&quot;/Z10001">
hreflang="&quot;lvs&quot;" href="/view/&quot;lvs&quot;/Z10001">
hreflang="&quot;dik&quot;" href="/view/&quot;dik&quot;/Z10001">

@Jdforrester-WMF - anything else needs to be done for this task? The wikifucntion beta has a longer list, e.g. view-source:https://wikifunctions.beta.wmflabs.org/view/en/Z10055

Change 962695 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] ZObjectSecondaryDataUpdate: Delete before adding language cache values

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

Change 962695 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] ZObjectSecondaryDataUpdate: Delete before adding language cache values

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

Change 966631 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] ZLangRegistry::fetchLanguageCodeFromZid(): Add to cache if there's a cache miss

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

Change 966631 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] ZLangRegistry::fetchLanguageCodeFromZid(): Add to cache if there's a cache miss

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