wikimedia-gadgets / VariantAlly

Enhance Chinese Wikipedia's language variant switching support / 优化中文维基百科的中文变体识别和切换 / 最佳化中文維基百科的中文變體識別和切換
GNU General Public License v2.0
3 stars 2 forks source link

rewriteAnchors doesn't check if the <a> tag had an 'href' #4

Closed edg2s closed 10 months ago

edg2s commented 10 months ago

OOUI buttons, such as those used in VE, use <a> tags without an href.

This script appears to rewrite the empty href back to the tag as <a href="undefined">, which means clicking on any tool in VE navigates you off the page.

Reported here: https://phabricator.wikimedia.org/T352501

diskdance commented 10 months ago

@edg2s Both from TypeScript or my own testing shows that for an without href accessing href returns an empty string.

The undefined is caused by Jon (WMF)'s hotfix which causes rewriteLink to return undefined when an exception is thrown.

edg2s commented 10 months ago

Sorry about that. Do you need help applying the fixes to this repo?

cc @jdlrobson

diskdance commented 10 months ago

I have asked admins to apply hot fixes for now. I'm currently working on various improvements on this project and I hope to deploy all the improvements to the wiki in the near future. Thanks!

jdlrobson commented 10 months ago

Sorry for my failed fix! I can confirm the error is no longer appearing in production.

Screenshot 2023-12-01 at 9 05 11 AM

Thanks @esanders for patching the production version.