Subramanya Sastry has uploaded a new change for review. https://gerrit.wikimedia.org/r/192349
Change subject: Don't crash if a client sends us non-spec-compliant template args ...................................................................... Don't crash if a client sends us non-spec-compliant template args * VE is sending us an array for a wikitext param in some cases (citoid integration bug -- filed separately) which is causing Parsoid to crash (reported by editors on the VE Feedback page). * This patch protects against a non-string parameter being passed to Parsoid. Change-Id: I64e5d41705fabd4debe6e27ec8c93a59254acfbf --- M lib/mediawiki.WikitextSerializer.js 1 file changed, 10 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/49/192349/1 diff --git a/lib/mediawiki.WikitextSerializer.js b/lib/mediawiki.WikitextSerializer.js index eccc42f..1f1999d 100644 --- a/lib/mediawiki.WikitextSerializer.js +++ b/lib/mediawiki.WikitextSerializer.js @@ -447,6 +447,16 @@ env: state.env}, tpl.params[k].html); } + + // SSS FIXME: Should we be doing this? Or just fail loudly? + if (typeof value !== "string") { + state.env.log("error/html2wt/spec", + "For param: ", k, + ", wt property should be a string but got: ", + value); + value = Util.tokensToString(value); + } + escapedValue = serializer.wteHandlers.escapeTplArgWT(state, value, opts); if (paramInfo.spc) { -- To view, visit https://gerrit.wikimedia.org/r/192349 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I64e5d41705fabd4debe6e27ec8c93a59254acfbf Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits