X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialFilepath.php;h=618fd1da488637a4f2be6df2ce21b3d8b0bdbee0;hb=6f54a1695b8e7ecf940ba60a800abce17e81122a;hp=49caaa3a1df980d6e2693715ecc89d1734560eaa;hpb=d716155c8b2d6e4a51a4110195cee7a1794846e8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialFilepath.php b/includes/specials/SpecialFilepath.php index 49caaa3a1d..618fd1da48 100644 --- a/includes/specials/SpecialFilepath.php +++ b/includes/specials/SpecialFilepath.php @@ -35,18 +35,23 @@ class SpecialFilepath extends RedirectSpecialPage { /** * Implement by redirecting through Special:Redirect/file. * - * @param string|null $subpage + * @param string|null $par * @return Title */ public function getRedirect( $par ) { $file = $par ?: $this->getRequest()->getText( 'file' ); + $redirect = null; if ( $file ) { - $argument = "file/$file"; - } else { - $argument = 'file'; + $redirect = SpecialPage::getSafeTitleFor( 'Redirect', "file/$file" ); } - return SpecialPage::getSafeTitleFor( 'Redirect', $argument ); + if ( $redirect === null ) { + // The user input is empty or an invalid title, + // redirect to form of Special:Redirect with the invalid value prefilled + $this->mAddedRedirectParams['wpvalue'] = $file; + $redirect = SpecialPage::getSafeTitleFor( 'Redirect', 'file' ); + } + return $redirect; } protected function getGroupName() {