jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/399203 )
Change subject: Remove link text normalization from CommonsLinkFormatter
......................................................................
Remove link text normalization from CommonsLinkFormatter
This is critical in diffs (see T99664), but can also be relevant in other
instances that use the same formatter.
This is different for other datatypes like quantities or coordinates. In
these cases normalization happens *before* a value is stored in the database.
The formatters do not do additional normalization. Neither should this one.
I think this makes this behaves more consistent and fits the users
expectations much more.
Bug: T99664
Change-Id: I870271c0b9fa21d2cf7159ca3397f744a0f39644
---
M lib/includes/Formatters/CommonsLinkFormatter.php
M lib/tests/phpunit/Formatters/CommonsLinkFormatterTest.php
2 files changed, 3 insertions(+), 3 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
Zoranzoki21: Looks good to me, but someone else must approve
diff --git a/lib/includes/Formatters/CommonsLinkFormatter.php
b/lib/includes/Formatters/CommonsLinkFormatter.php
index 3b3a25f..0b315c5 100644
--- a/lib/includes/Formatters/CommonsLinkFormatter.php
+++ b/lib/includes/Formatters/CommonsLinkFormatter.php
@@ -61,7 +61,7 @@
$attributes = array_merge( $this->attributes, [
'href' => '//commons.wikimedia.org/wiki/File:' .
$title->getPartialURL()
] );
- $html = Html::element( 'a', $attributes, $title->getText() );
+ $html = Html::element( 'a', $attributes, $fileName );
return $html;
}
diff --git a/lib/tests/phpunit/Formatters/CommonsLinkFormatterTest.php
b/lib/tests/phpunit/Formatters/CommonsLinkFormatterTest.php
index 7b1790c..c626111 100644
--- a/lib/tests/phpunit/Formatters/CommonsLinkFormatterTest.php
+++ b/lib/tests/phpunit/Formatters/CommonsLinkFormatterTest.php
@@ -25,7 +25,7 @@
return [
[
new StringValue( 'example.jpg' ), // Lower-case
file name
- '@<a
.*href="//commons.wikimedia.org/wiki/File:Example.jpg".*>.*Example.jpg.*</a>@'
+ '@<a
.*href="//commons.wikimedia.org/wiki/File:Example.jpg".*>.*example.jpg.*</a>@'
],
[
new StringValue( 'Example.jpg' ),
@@ -37,7 +37,7 @@
],
[
new StringValue( 'Example_underscore.jpg' ),
- '@<a
.*href="//commons.wikimedia.org/wiki/File:Example_underscore.jpg".*>.*Example
underscore.jpg.*</a>@'
+ '@<a
.*href="//commons.wikimedia.org/wiki/File:Example_underscore.jpg".*>.*Example_underscore.jpg.*</a>@'
],
[
new StringValue( 'Example+plus.jpg' ),
--
To view, visit https://gerrit.wikimedia.org/r/399203
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I870271c0b9fa21d2cf7159ca3397f744a0f39644
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Zoranzoki21 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits