r45344 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45343‎ | r45344 | r45345 >
Date:20:59, 2 January 2009
Author:simetrical
Status:ok (Comments)
Tags:
Comment:
Do not urlencode anchor in links we output

This fixes non-TOC links in IE5, 5.5, and 6 (didn't test 7) when
$wgEnforceHtmlIds is off. These browsers won't follow urlencoded
Unicode anchors in href's, they only work if not urlencoded. Having
non-urlencoded bits in href's should be perfectly fine, correct me if
I'm wrong.

As far as I can tell, Title::escapeFragmentForURL() is never used for
HTTP redirects, if there's any concern about those. The correct
function to fix those is Article::doRedirect(). My testing indicates
that IE{5,5.5,6} will not accept Unicode anchors in anchors in HTTP
redirects, whether urlencoded or not.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -452,8 +452,8 @@
453453 */
454454 static function escapeFragmentForURL( $fragment ) {
455455 global $wgEnforceHtmlIds;
456 - return wfUrlencode( Sanitizer::escapeId( $fragment,
457 - $wgEnforceHtmlIds ? array() : 'xml' ) );
 456+ return Sanitizer::escapeId( $fragment,
 457+ $wgEnforceHtmlIds ? array() : 'xml' );
458458 }
459459
460460 #----------------------------------------------------------------------------

Comments

#Comment by Brion VIBBER (talk | contribs)   00:08, 7 January 2009

We do redirects with fragments on for instance page save from a section edit. So.... it'd be nice to make sure it works. :)

Status & tagging log