LinkFilter::makeIndexes: Don't explode if the 'host' key is missing for news://
Bug: T347574 Change-Id: Idc6b389da974a70bdee9b1d49e4b5c45ccdd0d73
This commit is contained in:
parent
a985465024
commit
ec1b572362
2 changed files with 9 additions and 1 deletions
|
|
@ -193,7 +193,10 @@ class LinkFilter {
|
|||
// while we want to match the email's domain or news server the same way we are
|
||||
// matching hosts for other URLs.
|
||||
if ( in_array( $bits['scheme'], [ 'mailto', 'news' ] ) ) {
|
||||
$bits['host'] = $bits['path'];
|
||||
// (T347574) Only set host if it's not already set (if // is used)
|
||||
if ( array_key_exists( 'path', $bits ) ) {
|
||||
$bits['host'] = $bits['path'];
|
||||
}
|
||||
$bits['path'] = '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,11 @@ class LinkFilterTest extends MediaWikiLangTestCase {
|
|||
'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ],
|
||||
[ '', 'news:*.aol.com',
|
||||
'news:4df8kh$iagfewewf(at)newsbf02aaa.news.aol.com' ],
|
||||
|
||||
// (T347574) Only set host if it's not already set (if // is used)
|
||||
[ 'news:', 'comp.compression', 'news://comp.compression' ],
|
||||
[ 'news:', 'comp.compression', 'news:comp.compression' ],
|
||||
|
||||
[ '', 'git://github.com/prwef/abc-def.git', 'git://github.com/prwef/abc-def.git' ],
|
||||
[ 'git://', 'github.com/', 'git://github.com/prwef/abc-def.git' ],
|
||||
[ 'git://', '*.github.com/', 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ],
|
||||
|
|
|
|||
Loading…
Reference in a new issue