mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-12 04:40:25 +01:00
Merge pull request #1898 from ether/fix-bad-html-on-import
Don't crash on malformed HTML import
This commit is contained in:
commit
26d5a4fcca
1 changed files with 7 additions and 1 deletions
|
@ -31,7 +31,13 @@ function setPadHTML(pad, html, callback)
|
||||||
var padText = pad.text();
|
var padText = pad.text();
|
||||||
|
|
||||||
// Parse the incoming HTML with jsdom
|
// 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:');
|
||||||
apiLogger.debug(html);
|
apiLogger.debug(html);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue