Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Etherpad-lite 1.2.11 crash when uploading improper .html files #1894

Closed
joelrebel opened this issue Sep 18, 2013 · 9 comments · Fixed by #1898 or #1909
Closed

Etherpad-lite 1.2.11 crash when uploading improper .html files #1894

joelrebel opened this issue Sep 18, 2013 · 9 comments · Fixed by #1898 or #1909
Assignees

Comments

@joelrebel
Copy link

Im running etherpad-lite version 1.2.11

  • Our instance of etherpad-lite would crash when a user tried to HTML import a badly formatted html file, in this case it was a file which looked like :
<html><body><p>asdf</p></body></html><br/>
  • Basically, if a tag is defined outside of <html></html>, it'll cause etherpad-lite to crash
  • Also noticed, if I tried HTML import a file with no html tags, it causes etherpad lite to crash with the same above trace.
^[[31m[2013-09-18 15:30:41.399] [ERROR] console - ^[[39mTypeError: Object [ null ] has no method 'getAttribute'
    at Object.domInterface.nodeAttr (/var/www/etherpad-lite/src/static/js/contentcollector.js:69:16)
    at Object.cc.collectContent (/var/www/etherpad-lite/src/static/js/contentcollector.js:377:23)
    at Object.setPadHTML (/var/www/etherpad-lite/src/node/utils/ImportHtml.js:41:6)
    at async.series.fileExists (/var/www/etherpad-lite/src/node/handler/ImportHandler.js:145:20)
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:486:21
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:185:13
    at iterate (/var/www/etherpad-lite/src/node_modules/async/lib/async.js:108:13)
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:119:25
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:187:17
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:491:34
@JohnMcLear
Copy link
Member

I'm sure I fixed that at some point..

@joelrebel
Copy link
Author

Thanks for looking at this! I just tested it on the latest HEAD, both instances results in a crash.

  • Improper html <html><body><p>asdf</p></body></html><br/>
[2013-09-18 15:59:16.129] [ERROR] console - Error: Hierarchy request error
    at Object.core.Document.appendChild (/var/www/etherpad-lite/src/node_modules/jsdom-nocontextifiy/lib/jsdom/level1/core.js:1337:13)
    at setChild (/var/www/etherpad-lite/src/node_modules/jsdom-nocontextifiy/lib/jsdom/browser/htmltodom.js:173:17)
    at HtmlToDom.appendHtmlToElement (/var/www/etherpad-lite/src/node_modules/jsdom-nocontextifiy/lib/jsdom/browser/htmltodom.js:77:9)
    at Object.innerHTML (/var/www/etherpad-lite/src/node_modules/jsdom-nocontextifiy/lib/jsdom/browser/index.js:453:27)
    at Object.core.HTMLDocument.write (/var/www/etherpad-lite/src/node_modules/jsdom-nocontextifiy/lib/jsdom/level2/html.js:403:22)
    at exports.jsdom (/var/www/etherpad-lite/src/node_modules/jsdom-nocontextifiy/lib/jsdom.js:67:9)
    at Object.setPadHTML (/var/www/etherpad-lite/src/node/utils/ImportHtml.js:34:13)
    at async.series.fileExists (/var/www/etherpad-lite/src/node/handler/ImportHandler.js:169:20)
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:486:21
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:185:13
  • No html in file
[2013-09-18 15:59:52.530] [ERROR] console - TypeError: Object [ null ] has no method 'getAttribute'
    at Object.domInterface.nodeAttr (/var/www/etherpad-lite/src/static/js/contentcollector.js:69:16)
    at Object.cc.collectContent (/var/www/etherpad-lite/src/static/js/contentcollector.js:377:23)
    at Object.setPadHTML (/var/www/etherpad-lite/src/node/utils/ImportHtml.js:41:6)
    at async.series.fileExists (/var/www/etherpad-lite/src/node/handler/ImportHandler.js:169:20)
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:486:21
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:185:13
    at iterate (/var/www/etherpad-lite/src/node_modules/async/lib/async.js:108:13)
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:119:25
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:187:17
    at /var/www/etherpad-lite/src/node_modules/async/lib/async.js:491:34

@JohnMcLear
Copy link
Member

Assigned this to me because I think it's my code breaking here. Will fix ASAP (will be 72->240 hours)

@ghost ghost assigned JohnMcLear Sep 18, 2013
@JohnMcLear
Copy link
Member

Related to jsdom/jsdom#328

@joelrebel
Copy link
Author

Thank you for fixing this!

@joelrebel
Copy link
Author

Hey John,

If I name a file as .html, with no content at all, and attempt to import it, etherpad-lite crashes.

The crashfix for malformed HTML import like - <html><body><p>asdf</p></body></html><br/> works fine.

@JohnMcLear
Copy link
Member

good spot.

@JohnMcLear
Copy link
Member

@joelrebel please test my fix

@joelrebel
Copy link
Author

@JohnMcLear , fix works! no more crashes.
Thanks for the prompt response and fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants