This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mdk
Recipients mdk
Date 2017-08-09.11:38:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502278726.47.0.617689885912.issue31159@psf.upfronthosting.co.za>
In-reply-to
Content
Since ja has been added to the language switch, a bug appeared and in some case the switch won't ... switch.

Due to a regex bug in switchers.js, a needed trailing slash is sometimes not matched. It has not been detected previously as it can happen only when there more than two languages in the picker which is now the case.

Bug is in:  var language_regexp = '\.org/(' + Object.keys(all_languages).join('|') + '/)';

It only matches the trailing slash for the last language, currently the / is for ja, so fr does no longer match the needed slash.

Fix may consists in adding a non-matching group around the join.

But there's another issue when a user goes to a version in which there's a language picker but the current langage is not known by the picker, typically if a user is on /ja/2.7/ but the language picker with Japanese has only been merged on 3.6 and 3.7: the regex on /ja/2.7 will not contain "ja", so it will not be able to match it.


So we should write this regex otherwise, I grepped on the server logs and checked on the filesystem, this one should work better and still be safe:


    var language_regexp = '\.org/([a-z]{2}(?:-[a-z]{2})?/)';
History
Date User Action Args
2017-08-09 11:38:46mdksetrecipients: + mdk
2017-08-09 11:38:46mdksetmessageid: <1502278726.47.0.617689885912.issue31159@psf.upfronthosting.co.za>
2017-08-09 11:38:46mdklinkissue31159 messages
2017-08-09 11:38:46mdkcreate