diff options
author | John McLear <john@mclear.co.uk> | 2013-09-21 16:11:56 +0100 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2013-09-21 16:11:56 +0100 |
commit | 204118eea5b5c7a844af2d4257f8210cea7de059 (patch) | |
tree | 262d4ab888f883f7843fac13df62f62be0878d75 | |
parent | cf3c8e599f9d1f0afa1f107205c1d948203ec109 (diff) | |
download | etherpad-lite-204118eea5b5c7a844af2d4257f8210cea7de059.zip |
dont crash on malformed HTML import
-rw-r--r-- | src/node/utils/ImportHtml.js | 8 |
1 files changed, 7 insertions, 1 deletions
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+</g, '><')); + try{ + var doc = jsdom(html.replace(/>\n+</g, '><')); + }catch(e){ + apiLogger.warn("Error importing, possibly caused by malformed HTML"); + var doc = jsdom("<html><body><div>Error during import, possibly malformed HTML</div></body></html>"); + } + apiLogger.debug('html:'); apiLogger.debug(html); |