From 0673c1cde17a834e522399ff17e40588aaa4db0a Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 30 Jun 2020 20:10:56 +0200 Subject: [PATCH] fix display of empty files #663 --- js/privatebin.js | 3 ++- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 6826da4..a230ec1 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2763,7 +2763,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { // extract mediaType const mediaType = attachmentData.substring(5, mediaTypeEnd); // extract data and convert to binary - const decodedData = atob(attachmentData.substring(base64Start)); + const rawData = attachmentData.substring(base64Start); + const decodedData = rawData.length > 0 ? atob(rawData) : ''; // Transform into a Blob const buf = new Uint8Array(decodedData.length); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 71da5a6..c06372e 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -72,7 +72,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index fd13cc1..5f16f14 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -50,7 +50,7 @@ endif; ?> - +