Skip to content

Commit

Permalink
Clear file input on pste event, too
Browse files Browse the repository at this point in the history
Fixes #318
  • Loading branch information
rugk committed May 22, 2018
1 parent 567fa8b commit 1985dff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion js/privatebin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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('<form>').closest('form').get(0).reset();
$fileInput.unwrap();

readFileData(item.getAsFile());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tpl/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<?php
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]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->
Expand Down
2 changes: 1 addition & 1 deletion tpl/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<?php
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]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->
Expand Down

0 comments on commit 1985dff

Please sign in to comment.