From: Max Semenik Date: Mon, 18 Mar 2019 05:42:42 +0000 (-0700) Subject: Urlencode fragments when redirecting after editing X-Git-Tag: 1.34.0-rc.0~2491^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24ze_article%22%29%20.%20%22?a=commitdiff_plain;h=5b57369bcfd4fa282cfe0779d200aaeb7d527996;p=lhc%2Fweb%2Fwiklou.git 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.33 b/RELEASE-NOTES-1.33 index 405d5a75a1..bc449c70e3 100644 --- a/RELEASE-NOTES-1.33 +++ b/RELEASE-NOTES-1.33 @@ -128,6 +128,8 @@ For notes on 1.32.x and older releases, see HISTORY. === Bug fixes in 1.33 === * (T164211) Special:UserRights could sometimes fail with a "conflict detected" error when there weren't any conflicts. +* (T216029) Chrome redirects to Special:BadTitle after editing a section with + a non-Latin name on a page with non-Latin characters in title. === Action API changes in 1.33 === * (T198913) Added 'ApiOptions' hook. diff --git a/includes/EditPage.php b/includes/EditPage.php index 41238dff60..23cdc3b911 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -4557,7 +4557,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 ) ); } /**