فهرست منبع

Clear file input on pste event, too

Fixes https://github.com/PrivateBin/PrivateBin/issues/318
rugk 8 سال پیش
والد
کامیت
1985dff67c
3فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 4 1
      js/privatebin.js
  2. 1 1
      tpl/bootstrap.php
  3. 1 1
      tpl/page.php

+ 4 - 1
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('<form>').closest('form').get(0).reset();
+                            $fileInput.unwrap();
+
                             readFileData(item.getAsFile());
                         }
                     }

+ 1 - 1
tpl/bootstrap.php

@@ -75,7 +75,7 @@ if ($MARKDOWN):
 <?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]-->

+ 1 - 1
tpl/page.php

@@ -54,7 +54,7 @@ if ($QRCODE):
 <?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]-->