// Extract the title from the url
preg_match( '/title=(.*?)&action=raw/', $text, $matches );
if ( isset( $matches[1] ) ) {
- $title = Title::newFromText( $matches[1] );
+ $title = Title::newFromText( urldecode( $matches[1] ) );
if ( $title ) {
// Have a title, check that the current content equals what
// the redirect content should be
// Extract the title from the url
preg_match( '/title=(.*?)\\\\u0026action=raw/', $text, $matches );
if ( isset( $matches[1] ) ) {
- $title = Title::newFromText( $matches[1] );
+ $title = Title::newFromText( urldecode( $matches[1] ) );
if ( $title ) {
// Have a title, check that the current content equals what
// the redirect content should be
'Gadget:FooBaz.css',
"/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);"
],
+ [
+ 'User:😂/unicode.css',
+ '/* #REDIRECT */@import url(//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.css&action=raw&ctype=text/css);'
+ ],
];
// phpcs:enable
}
[ 'MediaWiki:MonoBook.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" ],
[ 'User:FooBar/common.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" ],
[ 'Gadget:FooBaz.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ],
+ [
+ 'User:😂/unicode.css',
+ '/* #REDIRECT */@import url(//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.css&action=raw&ctype=text/css);'
+ ],
# No #REDIRECT comment
[ null, "@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ],
# Wrong domain
'Gadget:FooBaz.js',
'/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");'
],
+ [
+ 'User:😂/unicode.js',
+ '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.js\u0026action=raw\u0026ctype=text/javascript");'
+ ],
];
// phpcs:enable
}
'Gadget:FooBaz.js',
'/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");'
],
+ // Unicode
+ [
+ 'User:😂/unicode.js',
+ '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.js\u0026action=raw\u0026ctype=text/javascript");'
+ ],
// No #REDIRECT comment
[
null,