Clear attachment if user cancel file select

This commit is contained in:
Haocen Xu 2019-08-16 13:38:08 -04:00
parent 3a9730f883
commit 078b8d8fd6
No known key found for this signature in database
GPG Key ID: 3F0D955A0F6AD729
1 changed files with 3 additions and 2 deletions

View File

@ -2750,9 +2750,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
$dragAndDropFileName.text(loadedFile.name); $dragAndDropFileName.text(loadedFile.name);
} }
file = loadedFile;
if (typeof loadedFile !== 'undefined') { if (typeof loadedFile !== 'undefined') {
file = loadedFile;
fileReader.onload = function (event) { fileReader.onload = function (event) {
const dataURL = event.target.result; const dataURL = event.target.result;
attachmentData = dataURL; attachmentData = dataURL;
@ -2765,6 +2764,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
TopNav.highlightFileupload(); TopNav.highlightFileupload();
}; };
fileReader.readAsDataURL(loadedFile); fileReader.readAsDataURL(loadedFile);
} else {
me.removeAttachmentData();
} }
} }