diff options
-rw-r--r-- | src/node/handler/ImportHandler.js | 12 | ||||
-rw-r--r-- | src/static/js/pad_utils.js | 2 | ||||
-rw-r--r-- | src/static/js/pluginfw/installer.js | 4 |
3 files changed, 13 insertions, 5 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); } diff --git a/src/static/js/pad_utils.js b/src/static/js/pad_utils.js index 50525e0c..bab6aa43 100644 --- a/src/static/js/pad_utils.js +++ b/src/static/js/pad_utils.js @@ -519,7 +519,7 @@ function setupGlobalExceptionHandler() { //show javascript errors to the user $("#editorloadingbox").css("padding", "10px"); $("#editorloadingbox").css("padding-top", "45px"); - $("#editorloadingbox").html("<div style='text-align:left;color:red;font-size:16px;'><b>An error occured</b><br>The error was reported with the following id: '" + errorId + "'<br><br><span style='color:black;font-weight:bold;font-size:16px'>Please send this error message to us: </span><div style='color:black;font-size:14px'>'" + $("#editorloadingbox").html("<div style='text-align:left;color:red;font-size:16px;'><b>An error occured</b><br>The error was reported with the following id: '" + errorId + "'<br><br><span style='color:black;font-weight:bold;font-size:16px'>Please press and hold Ctrl and press F5 to reload this page, if the problem persists please send this error message to your webmaster: </span><div style='color:black;font-size:14px'>'" + "ErrorId: " + errorId + "<br>URL: " + window.location.href + "<br>UserAgent: " + navigator.userAgent + "<br>" + msg + " in " + url + " at line " + linenumber + "'</div></div>"); } diff --git a/src/static/js/pluginfw/installer.js b/src/static/js/pluginfw/installer.js index b125a77c..e5602616 100644 --- a/src/static/js/pluginfw/installer.js +++ b/src/static/js/pluginfw/installer.js @@ -83,8 +83,8 @@ exports.search = function(searchTerm, maxCacheAge, cb) { searchTerm = searchTerm.toLowerCase(); for (var pluginName in results) { // for every available plugin if (pluginName.indexOf(plugins.prefix) != 0) continue; // TODO: Also search in keywords here! - - if(searchTerm && pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue; + + if(searchTerm && !~pluginName.toLowerCase().indexOf(searchTerm) && !~results[pluginName].description.toLowerCase().indexOf(searchTerm)) continue; res[pluginName] = results[pluginName]; } cb && cb(null, res) |