From 1985dff67c431d0ec0b423c2d0835db7bc2042dd Mon Sep 17 00:00:00 2001 From: rugk Date: Tue, 22 May 2018 13:09:15 +0200 Subject: [PATCH] Clear file input on pste event, too Fixes https://github.com/PrivateBin/PrivateBin/issues/318 --- js/privatebin.js | 5 ++++- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 6c64fe9..0c6e876 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2229,7 +2229,6 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { loadedFile = $fileInput[0].files[0]; $dragAndDropFileName.text(''); } else { - // TODO: cannot set original $fileWrap here for security reasons… $dragAndDropFileName.text(loadedFile.name); } @@ -2375,6 +2374,10 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { if (items.hasOwnProperty(i)) { var item = items[i]; if (item.kind === 'file') { + //Clear the file input: + $fileInput.wrap('
').closest('form').get(0).reset(); + $fileInput.unwrap(); + readFileData(item.getAsFile()); } } diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index cc4c4f3..7e1f47d 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -75,7 +75,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 175d263..1cc10c2 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -54,7 +54,7 @@ if ($QRCODE): - +