The regex in JavaScriptContent and CssContent was trying to pass
urlencoded stuff to Title::newFromText(), which would fail. Make sure we
urldecode it first.
Bug: T208264
Change-Id: I189c4c308da2875839ad8c1061332500f0e6d244
// Extract the title from the url
preg_match( '/title=(.*?)&action=raw/', $text, $matches );
if ( isset( $matches[1] ) ) {
// 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
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] ) ) {
// 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
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);"
],
'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);'
+ ],
[ '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);" ],
[ '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
# 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");'
],
'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");'
+ ],
'Gadget:FooBaz.js',
'/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");'
],
'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,
// No #REDIRECT comment
[
null,