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() {
386
386
var blockSize = chunk_size ;
387
387
if ( localFileInfo ) {
388
388
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 ) ;
394
401
}
395
402
}
396
403
up . setOption ( {
@@ -425,7 +432,8 @@ function QiniuJsSDK() {
425
432
ctx : ctx ,
426
433
percent : file . percent ,
427
434
total : info . total ,
428
- offset : info . offset
435
+ offset : info . offset ,
436
+ time : ( new Date ( ) ) . getTime ( )
429
437
} ) ) ;
430
438
} ) ;
431
439
You can’t perform that action at this time.
0 commit comments