jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/391135 )
Change subject: Sanitizer::safeEncodeAttribute(): also encode ]
..
Sanitizer::safeEncodeAttribute(): also encode ]
...so that it wouldn't break wikilinks, too.
Bug: T29694
Bug: T51672
Bug: T72875
Change-Id: I189bdefbc9034cf8d221a89d7158195de1c0fa6c
---
M includes/parser/Sanitizer.php
M tests/parser/parserTests.txt
2 files changed, 27 insertions(+), 2 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, but someone else must approve
C. Scott Ananian: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/parser/Sanitizer.php b/includes/parser/Sanitizer.php
index 4c99677..46cf2a5 100644
--- a/includes/parser/Sanitizer.php
+++ b/includes/parser/Sanitizer.php
@@ -1150,6 +1150,7 @@
'{'=> '',
'}'=> '', // prevent unpaired language
conversion syntax
'['=> '',
+ ']'=> '',
"''" => '',
'ISBN' => 'SBN',
'RFC' => 'FC',
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index a505cde..6e9f944 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -17774,7 +17774,7 @@
!! wikitext
!! html
-
+
!! end
@@ -17837,7 +17837,7 @@
!! wikitext
http://example.com/ link]">
!! html
-
+
!! end
@@ -29705,3 +29705,27 @@
#Foobar
!! end
+
+!! test
+T51672: Test for brackets in attributes of elements in external link texts
+!! wikitext
+[http://example.com/ link span]
+[http://example.com/ link span]
+
+!! html/php
+http://example.com/;>link
span
+http://example.com/;>link span
+
+!! end
+
+!! test
+T72875: Test for brackets in attributes of elements in internal link texts
+!! wikitext
+[[Foo|link span]]
+[[Foo|link span]]
+
+!! html/php
+link span
+link span
+
+!! end
--
To view, visit https://gerrit.wikimedia.org/r/391135
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I189bdefbc9034cf8d221a89d7158195de1c0fa6c
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem
Gerrit-Reviewer: Arlolra
Gerrit-Reviewer: Brian Wolff
Gerrit-Reviewer: C. Scott Ananian
Gerrit-Reviewer: Fomafix
Gerrit-Reviewer: Jackmcbarn
Gerrit-Reviewer: Subramanya Sastry
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits