jenkins-bot has submitted this change and it was merged.
Change subject: Use plain wfHttpError() if short code is not found
......................................................................
Use plain wfHttpError() if short code is not found
Using the MW interface to display an error message on the short domain
itself isn't possible because the normal relative URLs that MW will
generate will all be wrong since we're not on the main domain. Since
users really shouldn't be hitting this anyways, we can use the plain
unstyled wfHttpError() output.
Bug: T116512
Change-Id: I81327fce0930f983d2e258979bd84f4d1d091a7a
---
M SpecialUrlRedirector.php
1 file changed, 7 insertions(+), 1 deletion(-)
Approvals:
Alex Monk: Looks good to me, approved
jenkins-bot: Verified
diff --git a/SpecialUrlRedirector.php b/SpecialUrlRedirector.php
index f52c2c4..66d27d8 100644
--- a/SpecialUrlRedirector.php
+++ b/SpecialUrlRedirector.php
@@ -19,7 +19,13 @@
$out->redirect( $url, '301' );
} else {
// Invalid $par
- $out->showErrorPage( 'urlshortener-not-found-title',
'urlshortener-not-found-message' );
+ // This page is being served from the short domain, so
we can't use
+ // any of the MediaWiki interface because all relative
URLs will be wrong.
+ // And force English because we likely don't know the
proper interface lang :(
+ $title = $this->msg( 'urlshortener-not-found-title'
)->inLanguage( 'en' )->text();
+ $text = $this->msg( 'urlshortener-not-found-message'
)->inLanguage( 'en' )->text();
+ // wfHttpError does escaping
+ wfHttpError( 404, $title, $text );
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/276813
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I81327fce0930f983d2e258979bd84f4d1d091a7a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UrlShortener
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits