From: Max Semenik Date: Mon, 18 Mar 2019 05:42:42 +0000 (-0700) Subject: Urlencode fragments when redirecting after editing X-Git-Tag: 1.31.2~21 X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=c520c19a762d5116421b84d071f715ce22c6cc03 Urlencode fragments when redirecting after editing This is a quick fix for the main symptom of the Chrome bug that results in users being redirected to Special:BadTitle after section editing. We'll need to discuss a more permanent solution. Bug: T216029 Change-Id: I4b2d42ebc74031df86bc52310da71819da11c1ae --- diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 5eacf552a8..901c83a5fc 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -62,6 +62,8 @@ THIS IS NOT A RELEASE YET * (T199474) Fix typo in rebuildrecentchanges.php resulting in rogue flags. * (T218608) Fix an issue that prevents Extension:OAuth working when $wgBlockDisablesLogin is true. +* (T216029) Chrome redirects to Special:BadTitle after editing a section with + a non-Latin name on a page with non-Latin characters in title. == MediaWiki 1.31.1 == diff --git a/includes/EditPage.php b/includes/EditPage.php index a1d9ae82d5..5c37c42591 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -4578,7 +4578,10 @@ ERROR; return $wgParser->guessLegacySectionNameFromWikiText( $text ); } // Meanwhile, real browsers get real anchors - return $wgParser->guessSectionNameFromWikiText( $text ); + $name = $wgParser->guessSectionNameFromWikiText( $text ); + // With one little caveat: per T216029, fragments in HTTP redirects need to be urlencoded, + // otherwise Chrome double-escapes the rest of the URL. + return '#' . urlencode( mb_substr( $name, 1 ) ); } /**