r95627 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95626‎ | r95627 | r95628 >
Date:15:15, 28 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Fix bug in r94995: getCanonicalUrl() doesn't append the fragment. This is correct behavior for getInternalUrl() (which the code was based on) but not for getFullUrl() (which is what I'm swapping getCanonicalUrl() in for in certain places). Was exposed by a unit test in CodeReview breaking on me when I tried to use canonical URLs in e-mail notifications.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1037,13 +1037,15 @@
10381038 * e-mail notifications. Uses $wgCanonicalServer and the
10391039 * GetCanonicalURL hook.
10401040 *
 1041+ * NOTE: Unlike getInternalURL(), the canonical URL includes the fragment
 1042+ *
10411043 * @param $query string An optional query string
10421044 * @param $variant string Language variant of URL (for sr, zh, ...)
10431045 * @return string The URL
10441046 */
10451047 public function getCanonicalURL( $query = '', $variant = false ) {
10461048 global $wgCanonicalServer;
1047 - $url = $wgCanonicalServer . $this->getLocalURL( $query, $variant );
 1049+ $url = $wgCanonicalServer . $this->getLocalURL( $query, $variant ) . $this->getFragmentForURL();
10481050 wfRunHooks( 'GetCanonicalURL', array( &$this, &$url, $query ) );
10491051 return $url;
10501052 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r959011.17wmf1: MFT HTTPS / prot rel URL fixes: r95627, r95651, r95652, r95653, r95...catrope19:15, 31 August 2011
r964851.18: MFT protocol-relative URL saga: r95014, r95016, r95017, r95627, r95651,...catrope20:14, 7 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94995Per CR on r44412 and my promise in the commit summary of r94990, stop abusing...catrope11:23, 19 August 2011

Status & tagging log