jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/378042 )
Change subject: Fix further crashes from non-string template targets
......................................................................
Fix further crashes from non-string template targets
* Follow up to 5608e83f, where the possiblity of a non-string first
token was anticipated.
* Renders /am.wikipedia.org/v3/page/html/መለጠፊያ%3AIf/89130
Change-Id: I119953e4e2541be99e987a4126c9c0f1c1204359
---
M lib/wt2html/tt/TemplateHandler.js
1 file changed, 10 insertions(+), 4 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/wt2html/tt/TemplateHandler.js
b/lib/wt2html/tt/TemplateHandler.js
index 2ba1989..ed07943 100644
--- a/lib/wt2html/tt/TemplateHandler.js
+++ b/lib/wt2html/tt/TemplateHandler.js
@@ -481,13 +481,19 @@
// Strip ":" after skipping empty tokens, if any
if (isPF) {
while (firstTok === '') {
- firstTok = targetToks[0]; // FIXME:
Isn't guaranteed to be a string
+ firstTok = targetToks[0];
targetToks = targetToks.slice(1);
}
- console.assert(firstTok[0] === ':', 'Expecting
: in parser function definiton');
- firstTok = firstTok.slice(1);
+ if (typeof firstTok === 'string') {
+ console.assert(firstTok[0] === ':',
'Expecting : in parser function definiton');
+ pfArgToks =
[firstTok.slice(1)].concat(targetToks);
+ } else {
+ // FIXME: Again, protect from crashers.
See below.
+ pfArgToks = targetToks;
+ }
+ } else {
+ pfArgToks = [firstTok].concat(targetToks);
}
- pfArgToks = [firstTok].concat(targetToks);
} else {
// FIXME: In the scenario where the target itself is
not a string,
// protect from crashers by using the full token --
this is still
--
To view, visit https://gerrit.wikimedia.org/r/378042
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I119953e4e2541be99e987a4126c9c0f1c1204359
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits