From 204118eea5b5c7a844af2d4257f8210cea7de059 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 21 Sep 2013 16:11:56 +0100 Subject: dont crash on malformed HTML import --- src/node/utils/ImportHtml.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/node/utils/ImportHtml.js b/src/node/utils/ImportHtml.js index 7c638fb8..322e567e 100644 --- a/src/node/utils/ImportHtml.js +++ b/src/node/utils/ImportHtml.js @@ -31,7 +31,13 @@ function setPadHTML(pad, html, callback) var padText = pad.text(); // Parse the incoming HTML with jsdom - var doc = jsdom(html.replace(/>\n+<')); + try{ + var doc = jsdom(html.replace(/>\n+<')); + }catch(e){ + apiLogger.warn("Error importing, possibly caused by malformed HTML"); + var doc = jsdom("
Error during import, possibly malformed HTML
"); + } + apiLogger.debug('html:'); apiLogger.debug(html); -- cgit v1.2.3