dont crash on malformed HTML import

pull/1898/head
John McLear 2013-09-21 16:11:56 +01:00
parent cf3c8e599f
commit 204118eea5
1 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,13 @@ function setPadHTML(pad, html, callback)
var padText = pad.text();
// Parse the incoming HTML with jsdom
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);