Clear file input on pste event, too

Fixes https://github.com/PrivateBin/PrivateBin/issues/318
This commit is contained in:
rugk 2018-05-22 13:09:15 +02:00
parent 567fa8b61f
commit 1985dff67c
No known key found for this signature in database
GPG key ID: 05D40A636AFAB34D
3 changed files with 6 additions and 3 deletions

View file

@ -2229,7 +2229,6 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
loadedFile = $fileInput[0].files[0]; loadedFile = $fileInput[0].files[0];
$dragAndDropFileName.text(''); $dragAndDropFileName.text('');
} else { } else {
// TODO: cannot set original $fileWrap here for security reasons…
$dragAndDropFileName.text(loadedFile.name); $dragAndDropFileName.text(loadedFile.name);
} }
@ -2375,6 +2374,10 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
if (items.hasOwnProperty(i)) { if (items.hasOwnProperty(i)) {
var item = items[i]; var item = items[i];
if (item.kind === 'file') { if (item.kind === 'file') {
//Clear the file input:
$fileInput.wrap('<form>').closest('form').get(0).reset();
$fileInput.unwrap();
readFileData(item.getAsFile()); readFileData(item.getAsFile());
} }
} }

View file

@ -75,7 +75,7 @@ if ($MARKDOWN):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-CfLdTT20PvajSSX1FQB1Jqd26HKDLTlIfuS/iqBktG42V2H4bmlhU+qVGH/JOGxzFHe16IbaOxcipuJPDshoEQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-bagkP/DFFnY16P1MohHVSPuymjJbJl/5kXuiWTrBeXudsxKi8YwuY90owWuH+YIUNUkTS4Dua9Zf4iw8L/kxEg==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

View file

@ -54,7 +54,7 @@ if ($QRCODE):
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-CfLdTT20PvajSSX1FQB1Jqd26HKDLTlIfuS/iqBktG42V2H4bmlhU+qVGH/JOGxzFHe16IbaOxcipuJPDshoEQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-bagkP/DFFnY16P1MohHVSPuymjJbJl/5kXuiWTrBeXudsxKi8YwuY90owWuH+YIUNUkTS4Dua9Zf4iw8L/kxEg==" crossorigin="anonymous"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->