Adding PDF attachment (via drag & drop) breaks markdown preview
A wild bug appeared when testing https://github.com/PrivateBin/PrivateBin/pull/1797 but I could reproduce it on stable aka privatebin.net too.
Steps to reproduce
- (Likely have file upload enabled)
- Write a text like
See https://example.comin the field. - (Optionally) Click "Preview" to preview markdown
- Drag and drop a PDF file (any file) into the browser.
Second part: 4. Now switch back to "Edit" mode and "Preview" again
What happens
File is attached and everything looks fine first:
However, you can already see a logged exception (this only happens, when you're currently previewing though):
Uncaught TypeError: me.handleAttachmentPreview is not a function
onload https://privatebin.net/js/privatebin.js?2.0.4:3282
readFileData https://privatebin.net/js/privatebin.js?2.0.4:3275
readFileData https://privatebin.net/js/privatebin.js?2.0.4:3272
handleDrop https://privatebin.net/js/privatebin.js?2.0.4:3380
jQuery 8
draghover https://privatebin.net/js/privatebin.js?2.0.4:26
jQuery 2
draghover https://privatebin.net/js/privatebin.js?2.0.4:15
addDragDropHandler https://privatebin.net/js/privatebin.js?2.0.4:3384
init https://privatebin.net/js/privatebin.js?2.0.4:3484
init https://privatebin.net/js/privatebin.js?2.0.4:6010
<anonymous> https://privatebin.net/js/privatebin.js?2.0.4:39
jQuery 9
<anonymous> https://privatebin.net/js/privatebin.js?2.0.4:36in https://github.com/PrivateBin/PrivateBin/pull/1797 it's:
Uncaught TypeError: me.handleAttachmentPreview is not a function
onload https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:3182
readFileData https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:3175
readFileData https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:3172
handleDrop https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:3283
addDragDropHandler https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:3301
init https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:3386
init https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:6026
<anonymous> https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:6110
EventListener.handleEvent* https://probable-waddle-wrx76wjwv9c577r-8080.app.github.dev/js/privatebin.js?2.0.4:6107When you cycle back to Edit and back to Preview, markdown does not render at all, for some reason?
What should happen
Always preview correctly. Both features should not influence each other.
Additional information
Maybe it is actually also two bugs - the one being the Markdown rendering bug, the other being the exception being logged (which i guess is a - wrong? - try to render a PDF preview?).
Basic information
Server address: https://privatebin.net/
Server OS: /
Webserver: /
Browser: Firefox 151
PrivateBin version: 2.0.4
I can reproduce this issue on https://privatebin.net: Yes
Source: PrivateBin/PrivateBin