From e1ecb47aaba94d95b7c1996a831f5a5a78e08056 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 12 Jan 2006 10:06:54 +0000 Subject: [PATCH] * (bug 4571) Partial fix hack for {{fulllurl:}} in action=render Quick hack to do the same check in getFullUrl() that happens in getLocalUrl() and if it matches *don't* add a duplicate URL prefix. However anything is still broken that expects it, such as {{localurl:}} and it feels generally hacky. Also switched from getText() which does expensive encoding checks to getVal() --- RELEASE-NOTES | 1 + includes/Title.php | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6440a95870..d367ab0e31 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -465,6 +465,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 4104) Added OutputPageBeforeHTML hook for tweaking primary wiki output HTML on final output (cached or not) * Avoid PHP notice on command-line scripts if empty argument is passed ('') +* (bug 4571) Partial fix hack for {{fulllurl:}} in action=render === Caveats === diff --git a/includes/Title.php b/includes/Title.php index 0565ee23d4..33d7ef3f98 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -665,10 +665,16 @@ class Title { * @access public */ function getFullURL( $query = '' ) { - global $wgContLang, $wgServer; + global $wgContLang, $wgServer, $wgRequest; if ( '' == $this->mInterwiki ) { - $url = $wgServer . $this->getLocalUrl( $query ); + $url = $this->getLocalUrl( $query ); + + // Ugly quick hack to avoid duplicate prefixes (bug 4571 etc) + // Correct fix would be to move the prepending elsewhere. + if ($wgRequest->getVal('action') != 'render') { + $url = $wgServer . $url; + } } else { $baseUrl = $this->getInterwikiLink( $this->mInterwiki ); @@ -732,8 +738,10 @@ class Title { $url = "{$wgScript}?title={$dbkey}&{$query}"; } } - - if ($wgRequest->getText('action') == 'render') { + + // FIXME: this causes breakage in various places when we + // actually expected a local URL and end up with dupe prefixes. + if ($wgRequest->getVal('action') == 'render') { $url = $wgServer . $url; } } -- 2.20.1