jenkins-bot has submitted this change and it was merged.
Change subject: Decode encoded link titles when generating them from text
......................................................................
Decode encoded link titles when generating them from text
Percent-encoded characters are forbidden in titles. Copying URLs around will
tend to wind up when them percent-encoded when you paste. Therefore, when
trying to build a title from a pasted link, decode it first.
Change-Id: Ia0abcb2d903b04d99c7db16eb0a5962480b138d5
---
M modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
1 file changed, 9 insertions(+), 1 deletion(-)
Approvals:
Divec: Looks good to me, approved
Jforrester: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
index fafa709..0be6180 100644
--- a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
+++ b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
@@ -117,7 +117,15 @@
// in which case it's preceded by one or more instances of "./" or
"../", so strip those
matches = href.match( /^((?:\.\.?\/)*)(.*)$/ );
- return { title: matches[ 2 ], hrefPrefix: matches[ 1 ], isInternal:
isInternal };
+ // Percent-encoded characters are forbidden in titles... but if we're
+ // copy/pasting URLs around, they're likely to wind up encoded at this
+ // point. So decode them, otherwise this is going to cause failures
+ // elsewhere.
+ return {
+ title: ve.safeDecodeURIComponent( matches[ 2 ] ),
+ hrefPrefix: matches[ 1 ],
+ isInternal: isInternal
+ };
};
ve.dm.MWInternalLinkAnnotation.static.toDomElements = function () {
--
To view, visit https://gerrit.wikimedia.org/r/293332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0abcb2d903b04d99c7db16eb0a5962480b138d5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: Divec <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits