From 078b8d8fd6542d1afc04147187a0a04c1381346f Mon Sep 17 00:00:00 2001 From: Haocen Xu Date: Fri, 16 Aug 2019 13:38:08 -0400 Subject: [PATCH] Clear attachment if user cancel file select --- js/privatebin.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index bf354e4..aea4275 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2750,9 +2750,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { $dragAndDropFileName.text(loadedFile.name); } - file = loadedFile; - if (typeof loadedFile !== 'undefined') { + file = loadedFile; fileReader.onload = function (event) { const dataURL = event.target.result; attachmentData = dataURL; @@ -2765,6 +2764,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { TopNav.highlightFileupload(); }; fileReader.readAsDataURL(loadedFile); + } else { + me.removeAttachmentData(); } }