etherpad-lite icon indicating copy to clipboard operation
etherpad-lite copied to clipboard

Pad crashes on pasting html containing <li>

Open dcht00 opened this issue 1 year ago • 7 comments

Env: Ubuntu + Firefox

Reproduce: echo '<li>this crashes</li>' | xclip -selection clipboard -t text/html (or just copy any html with a list item) ... and paste into a pad

Result

TypeError: b.lineAttributes.list is undefined
at https://#####/padbootstrap-sxsSWavtLWA.min.js at line 20
ErrorId: vYIhQJ3X8o7VeqsTlv2t
Uncaught exception
URL: https://#####/p/test-wtfpaste
UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0

Discovered by trying to paste a ChatGPT response including a list of items into a pad.

dcht00 avatar Sep 16 '24 04:09 dcht00

echo '<li>this crashes</li>' | xclip -selection clipboard -t text/html

@Gared Do you use Ubuntu by chance? I used Windows and just copy pasted the W3C example to my pad and it didn't do anything https://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_intro

SamTV12345 avatar Sep 16 '24 16:09 SamTV12345

:) That example works for me too.

Try this: https://archive.totalism.org/breaks_etherpad.html

I think w3c one works because there's an ul around, which is technically mandatory. When copying from there , even if you just take a single item, Firefox makes another copy buffer:

in addition to text/html <meta http-equiv="content-type" content="text/html; charset=utf-8"><li>Tea</li> also text/_moz_htmlcontext <html><body contenteditable="false"><ul></ul></body></html>

Not sure how it all works there ... but in any case, it breaks on my example, and also copying from ChatGPT, if you don't also capture the before-beginning of the list, which includes the ul .

dcht00 avatar Sep 16 '24 22:09 dcht00

That works unfortunately too on my instance https://pad.samtv.fyi/p/test

SamTV12345 avatar Sep 21 '24 11:09 SamTV12345

Weird! For me, on that instance, with Chromium:

TypeError: Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf')
at https://pad.samtv.fyi/padbootstrap-dFzLwc4hpa0.min.js at line 20
ErrorId: 3IjNALPg8ERIiv9pM1AY
Uncaught exception
URL: https://pad.samtv.fyi/p/test
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

With Firefox:

TypeError: b.lineAttributes.list is undefined
at https://pad.samtv.fyi/padbootstrap-dFzLwc4hpa0.min.js at line 20
ErrorId: 00GdaCnxM3eJOfhYNWSY
Uncaught exception
URL: https://pad.samtv.fyi/p/test
UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0

dcht00 avatar Sep 25 '24 01:09 dcht00

Weird! For me, on that instance, with Chromium:

TypeError: Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf')
at https://pad.samtv.fyi/padbootstrap-dFzLwc4hpa0.min.js at line 20
ErrorId: 3IjNALPg8ERIiv9pM1AY
Uncaught exception
URL: https://pad.samtv.fyi/p/test
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

With Firefox:

TypeError: b.lineAttributes.list is undefined
at https://pad.samtv.fyi/padbootstrap-dFzLwc4hpa0.min.js at line 20
ErrorId: 00GdaCnxM3eJOfhYNWSY
Uncaught exception
URL: https://pad.samtv.fyi/p/test
UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0

image

The pad is still intact or did I misread the pad crash?

SamTV12345 avatar Oct 04 '24 16:10 SamTV12345

Sorry, missed the question there, yes, on refresh, the pad is as was before the paste.

dcht00 avatar Oct 14 '24 01:10 dcht00