Consistent label escaping in makeBrokenImageLinkObj
Html::element is more lenient about which characters it escapes. But really this is just factored out of the next patch for ease of review. Change-Id: I9abb4d866a624df7bf4628ab9cc581967e715160
This commit is contained in:
parent
6c74e5e59d
commit
c2cef6cb58
2 changed files with 6 additions and 7 deletions
|
|
@ -685,6 +685,7 @@ class Linker {
|
|||
if ( $label == '' ) {
|
||||
$label = $title->getPrefixedText();
|
||||
}
|
||||
$html = htmlspecialchars( $label );
|
||||
$repoGroup = MediaWikiServices::getInstance()->getRepoGroup();
|
||||
$currentExists = $time
|
||||
&& $repoGroup->findFile( $title ) !== false;
|
||||
|
|
@ -696,23 +697,21 @@ class Linker {
|
|||
// We already know it's a redirect, so mark it accordingly
|
||||
return self::link(
|
||||
$title,
|
||||
htmlspecialchars( $label ),
|
||||
$html,
|
||||
[ 'class' => 'mw-redirect' ],
|
||||
wfCgiToArray( $query ),
|
||||
[ 'known', 'noclasses' ]
|
||||
);
|
||||
}
|
||||
|
||||
return Html::element( 'a', [
|
||||
return Html::rawElement( 'a', [
|
||||
'href' => self::getUploadUrl( $title, $query ),
|
||||
'class' => 'new',
|
||||
'title' => $title->getPrefixedText()
|
||||
], $label );
|
||||
], $html );
|
||||
}
|
||||
|
||||
return self::link(
|
||||
$title,
|
||||
htmlspecialchars( $label ),
|
||||
$html,
|
||||
[],
|
||||
wfCgiToArray( $query ),
|
||||
[ 'known', 'noclasses' ]
|
||||
|
|
|
|||
|
|
@ -8504,7 +8504,7 @@ File containing double quotes and spaces
|
|||
!! wikitext
|
||||
[[File:Cool "Gator".png]]
|
||||
!! html/php+tidy
|
||||
<p><a href="/index.php?title=Special:Upload&wpDestFile=Cool_%22Gator%22.png" class="new" title="File:Cool "Gator".png">File:Cool "Gator".png</a>
|
||||
<p><a href="/index.php?title=Special:Upload&wpDestFile=Cool_%22Gator%22.png" class="new" title="File:Cool "Gator".png">File:Cool "Gator".png</a>
|
||||
</p>
|
||||
!! html/parsoid
|
||||
<p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Cool_%22Gator%22.png"><span resource='./File:Cool_"Gator".png' data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png"},"sa":{"resource":"File:Cool \"Gator\".png"}}'>File:Cool "Gator".png</span></a></span></p>
|
||||
|
|
|
|||
Loading…
Reference in a new issue