#1863·PrivateBin

Adding PDF attachment (via drag & drop) breaks markdown preview

Author: rugkCreated Jun 16, 2026Updated Jun 16, 2026
Labelsbug

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

  1. (Likely have file upload enabled)
  2. Write a text like See https://example.com in the field.
  3. (Optionally) Click "Preview" to preview markdown
  4. 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:

Image

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:36

in 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:6107

When 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