diff options
author | John McLear <john@mclear.co.uk> | 2013-09-27 14:47:34 +0100 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2013-09-27 14:47:34 +0100 |
commit | c615ccf514e04e683885f7478df1bea95857f48c (patch) | |
tree | a0a760f81d9a69a94e4328d7b6bbdc5e46da4c58 /src | |
parent | 3e1e92c100aa9f0b024c8b6c31ae1a2882cfa500 (diff) | |
download | etherpad-lite-c615ccf514e04e683885f7478df1bea95857f48c.zip |
dont crash on importing blank html
Diffstat (limited to 'src')
-rw-r--r-- | src/node/handler/ImportHandler.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index d6b15eaf..98909354 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -28,7 +28,9 @@ var ERR = require("async-stacktrace") , settings = require('../utils/Settings') , formidable = require('formidable') , os = require("os") - , importHtml = require("../utils/ImportHtml"); + , importHtml = require("../utils/ImportHtml") + , log4js = require('log4js'); + //load abiword only if its enabled if(settings.abiword != null) @@ -42,6 +44,8 @@ var tmpDirectory = process.env.TEMP || process.env.TMPDIR || process.env.TMP || */ exports.doImport = function(req, res, padId) { + var apiLogger = log4js.getLogger("ImportHandler"); + //pipe to a file //convert file to html via abiword //set html in the pad @@ -169,7 +173,11 @@ exports.doImport = function(req, res, padId) function(callback) { var fileEnding = path.extname(srcFile).toLowerCase(); if (abiword || fileEnding == ".htm" || fileEnding == ".html") { - importHtml.setPadHTML(pad, text); + try{ + importHtml.setPadHTML(pad, text); + }catch(e){ + apiLogger.warn("Error importing, possibly caused by malformed HTML"); + } } else { pad.setText(text); } |