File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -386,11 +386,18 @@ function QiniuJsSDK() {
386386 var blockSize = chunk_size ;
387387 if ( localFileInfo ) {
388388 localFileInfo = JSON . parse ( localFileInfo ) ;
389- file . loaded = localFileInfo . offset ;
390- file . percent = localFileInfo . percent ;
391- ctx = localFileInfo . ctx ;
392- if ( localFileInfo . offset + blockSize > file . size ) {
393- blockSize = file . size - localFileInfo . ctx ;
389+ var now = ( new Date ( ) ) . getTime ( ) ;
390+ var before = localFileInfo . time || 0 ;
391+ var aDay = 24 * 60 * 60 * 1000 ; // milliseconds
392+ if ( now - before < aDay ) {
393+ file . loaded = localFileInfo . offset ;
394+ file . percent = localFileInfo . percent ;
395+ ctx = localFileInfo . ctx ;
396+ if ( localFileInfo . offset + blockSize > file . size ) {
397+ blockSize = file . size - localFileInfo . offset ;
398+ }
399+ } else {
400+ localStorage . removeItem ( file . name ) ;
394401 }
395402 }
396403 up . setOption ( {
@@ -425,7 +432,8 @@ function QiniuJsSDK() {
425432 ctx : ctx ,
426433 percent : file . percent ,
427434 total : info . total ,
428- offset : info . offset
435+ offset : info . offset ,
436+ time : ( new Date ( ) ) . getTime ( )
429437 } ) ) ;
430438 } ) ;
431439
You can’t perform that action at this time.
0 commit comments