From 36cb37c02963ca822903d571c97c9a6004c79746 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 13 Mar 2022 20:18:51 +0100 Subject: [PATCH] prevent error when attachments are disabled, but paste with attachment gets displayed --- CHANGELOG.md | 1 + js/privatebin.js | 6 ++++++ tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6137f3..a3188569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * CHANGED: Removed configurable `dir` for `traffic` & `purge` limiters (#419) * CHANGED: Server salt, traffic and purge limiter now stored in the storage backend (#419) * CHANGED: Drop support for attachment download in IE + * FIXED: Error when attachments are disabled, but paste with attachment gets displayed * **1.3.5 (2021-04-05)** * ADDED: Translations for Hebrew, Lithuanian, Indonesian and Catalan * ADDED: Make the project info configurable (#681) diff --git a/js/privatebin.js b/js/privatebin.js index 53474bd1..a1308620 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2816,6 +2816,9 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ me.setAttachment = function(attachmentData, fileName) { + // skip, if attachments got disabled + if (!$attachmentLink || !$attachmentPreview) return; + // data URI format: data:[][;base64], // position in data URI string of where data begins @@ -2859,6 +2862,9 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ me.showAttachment = function() { + // skip, if attachments got disabled + if (!$attachment || !$attachmentPreview) return; + $attachment.removeClass('hidden'); if (attachmentHasPreview) { diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index fac75df3..7fe82e04 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -73,7 +73,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index 2ff6ea7e..5823f71b 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -51,7 +51,7 @@ endif; ?> - +