mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Interwiki
synced 2024-11-24 06:24:16 +00:00
(Bug 30599) Filter problematic prefix characters
Change-Id: Icf0058407c51a314583907a54257cb10fa4826e5
This commit is contained in:
parent
116b695dbd
commit
bbc4c629b2
|
@ -189,8 +189,12 @@ class SpecialInterwiki extends SpecialPage {
|
|||
$prefix = $request->getVal( 'wpInterwikiPrefix' );
|
||||
$do = $request->getVal( 'wpInterwikiAction' );
|
||||
// Show an error if the prefix is invalid (only when adding one).
|
||||
// Invalid characters are ':', '&', '=' and whitespace.
|
||||
if ( preg_match( '/[\s:&=]/', $prefix ) && $do === 'add' ) {
|
||||
// Invalid characters for a title should also be invalid for a prefix.
|
||||
// Whitespace, ':', '&' and '=' are invalid, too.
|
||||
// (Bug 30599).
|
||||
global $wgLegalTitleChars;
|
||||
$validPrefixChars = preg_replace( '/[ :&=]/', '', $wgLegalTitleChars );
|
||||
if ( preg_match( "/\s|[^$validPrefixChars]/", $prefix ) && $do === 'add' ) {
|
||||
$this->error( 'interwiki-badprefix', htmlspecialchars( $prefix ) );
|
||||
$this->showForm( $do );
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue