Attachment preview breaks because `handleAttachmentPreview` is undefined
Did you use the FAQ section?
- Yes, I have read [the FAQ](https://github.com/PrivateBin/PrivateBin/wiki/FAQ) and I found no solution/answer there.
Adding a file while the editor is already in preview mode triggers a JavaScript error because an undefined method is called.
Steps to reproduce
- Open PrivateBin.
- Switch the editor to preview mode.
- 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:
me.handleAttachmentPreview($attachmentPreview, dataURL);However, the defined method appears to be:
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
Source: PrivateBin/PrivateBin