dont crash on importing blank html

pull/1909/head
John McLear 2013-09-27 14:47:34 +01:00
parent 3e1e92c100
commit c615ccf514
3 changed files with 44 additions and 2 deletions

34
bin/release.js Normal file
View File

@ -0,0 +1,34 @@
// A script to Release Etherpad.
var etherRelease = {
init: function(){
// promptUser
promptUser(function(){
package.update(version){
}
});
},
versionNumber: function(){
get: function(){
}
},
versionNumber.get: function(){
},
/* Continuous integration */
ci: function(){
hasPassed = function(){
// TODO
return true;
}
},
}

0
dirty.db Normal file
View File

View File

@ -28,7 +28,9 @@ var ERR = require("async-stacktrace")
, settings = require('../utils/Settings') , settings = require('../utils/Settings')
, formidable = require('formidable') , formidable = require('formidable')
, os = require("os") , os = require("os")
, importHtml = require("../utils/ImportHtml"); , importHtml = require("../utils/ImportHtml")
, log4js = require('log4js');
//load abiword only if its enabled //load abiword only if its enabled
if(settings.abiword != null) 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) exports.doImport = function(req, res, padId)
{ {
var apiLogger = log4js.getLogger("ImportHandler");
//pipe to a file //pipe to a file
//convert file to html via abiword //convert file to html via abiword
//set html in the pad //set html in the pad
@ -169,7 +173,11 @@ exports.doImport = function(req, res, padId)
function(callback) { function(callback) {
var fileEnding = path.extname(srcFile).toLowerCase(); var fileEnding = path.extname(srcFile).toLowerCase();
if (abiword || fileEnding == ".htm" || fileEnding == ".html") { if (abiword || fileEnding == ".htm" || fileEnding == ".html") {
try{
importHtml.setPadHTML(pad, text); importHtml.setPadHTML(pad, text);
}catch(e){
apiLogger.warn("Error importing, possibly caused by malformed HTML");
}
} else { } else {
pad.setText(text); pad.setText(text);
} }