From f9ca524ef997bf3ddb3fed3c6fa7ee6ef4a7b12f Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 17 Nov 2015 17:42:47 -0800 Subject: [PATCH] Wikitext paste: Fail if result has no visible content For example if '[[category:foo]]' is pasted. Bug: T118191 Change-Id: I9c51846414dd6b885b33f1dc9076edadbc6464c4 --- .../ve.ui.MWWikitextStringTransferHandler.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js index 79b5c6d635..5db946f201 100644 --- a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js +++ b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js @@ -106,6 +106,10 @@ ve.ui.MWWikitextStringTransferHandler.prototype.process = function () { null // No sanitization, since HTML is from Parsoid ); + if ( !doc.data.hasContent() ) { + return failure(); + } + // Attempt to undo outermost p-wrapping if possible surface = new ve.dm.Surface( doc ); try {