#1884·PrivateBin

Attachment preview breaks because `handleAttachmentPreview` is undefined

Author: marouane-hassineCreated Jul 17, 2026Updated Jul 18, 2026
Labelsbug

Did you use the FAQ section?

Adding a file while the editor is already in preview mode triggers a JavaScript error because an undefined method is called.

Steps to reproduce

  1. Open PrivateBin.
  2. Switch the editor to preview mode.
  3. Attach a file.

What happens

The browser console reports a TypeError because handleAttachmentPreview is not defined, and the attachment preview is not displayed.

The affected call is in js/privatebin.js:

javascript
me.handleAttachmentPreview($attachmentPreview, dataURL);

However, the defined method appears to be:

javascript
me.handleBlobAttachmentPreview($targetElement, blobUrl, mimeType)

What should happen

The attachment preview should be rendered without a JavaScript error.

Additional information

The upload data itself still appears to be stored in attachmentsData; the issue is limited to preview rendering.

Relevant file:

  • js/privatebin.js

Basic information

Server address: Local development instance

Server OS: macOS / local development environment

Webserver: PHP CLI / local test environment

Browser: Reproducible in browser with developer console open

PrivateBin version: 2.0.5 / master

I can reproduce this issue on https://privatebin.net/: Yes