@@ -263,7 +263,7 @@ function QiniuJsSDK() {
263
263
// qiniu service max_chunk_size is 4m
264
264
// reset chunk_size to max_chunk_size(4m) when chunk_size > 4m
265
265
}
266
- }
266
+ } ;
267
267
reset_chunk_size ( ) ;
268
268
269
269
var getUpToken = function ( ) {
@@ -287,7 +287,8 @@ function QiniuJsSDK() {
287
287
var key = '' ,
288
288
unique_names = false ;
289
289
if ( ! op . save_key ) {
290
- unique_names = up . getOption ( 'unique_names' ) || ( up . settings && up . settings . unique_names ) ;
290
+ unique_names = up . getOption && up . getOption ( 'unique_names' ) ;
291
+ unique_names = unique_names || ( up . settings && up . settings . unique_names ) ;
291
292
if ( unique_names ) {
292
293
var ext = that . getFileExtension ( file . name ) ;
293
294
key = ext ? file . id + '.' + ext : file . id ;
@@ -315,7 +316,8 @@ function QiniuJsSDK() {
315
316
uploader . init ( ) ;
316
317
317
318
uploader . bind ( 'FilesAdded' , function ( up , files ) {
318
- var auto_start = up . getOption ( 'auto_start' ) || ( up . settings && up . settings . auto_start ) ;
319
+ var auto_start = up . getOption && up . getOption ( 'auto_start' ) ;
320
+ auto_start = auto_start || ( up . settings && up . settings . auto_start ) ;
319
321
if ( auto_start ) {
320
322
$ . each ( files , function ( i , file ) {
321
323
up . start ( ) ;
@@ -351,7 +353,8 @@ function QiniuJsSDK() {
351
353
} ;
352
354
353
355
354
- var chunk_size = up . getOption ( 'chunk_size' ) || ( up . settings && up . settings . chunk_size ) ;
356
+ var chunk_size = up . getOption && up . getOption ( 'chunk_size' ) ;
357
+ chunk_size = chunk_size || ( up . settings && up . settings . chunk_size ) ;
355
358
356
359
if ( uploader . runtime === 'html5' && chunk_size ) {
357
360
if ( file . size < chunk_size ) {
@@ -379,8 +382,8 @@ function QiniuJsSDK() {
379
382
380
383
ctx = ctx ? ctx + ',' + res . ctx : res . ctx ;
381
384
var leftSize = info . total - info . offset ;
382
- var chunk_size = up . getOption ( 'chunk_size' ) || ( up . settings && up . settings . chunk_size ) ;
383
-
385
+ var chunk_size = up . getOption && up . getOption ( ' chunk_size' ) ;
386
+ chunk_size = chunk_size || ( up . settings && up . settings . chunk_size ) ;
384
387
if ( leftSize < chunk_size ) {
385
388
up . setOption ( {
386
389
'url' : 'http://up.qiniu.com/mkblk/' + leftSize
@@ -399,7 +402,8 @@ function QiniuJsSDK() {
399
402
errTip = '上传失败。请稍后再试。' ;
400
403
break ;
401
404
case plupload . FILE_SIZE_ERROR :
402
- var max_file_size = up . getOption ( 'max_file_size' ) || ( up . settings && up . settings . max_file_size ) ;
405
+ var max_file_size = up . getOption && up . getOption ( 'max_file_size' ) ;
406
+ max_file_size = max_file_size || ( up . settings && up . settings . max_file_size ) ;
403
407
errTip = '浏览器最大可上传' + max_file_size + '。更大文件请使用命令行工具。' ;
404
408
break ;
405
409
case plupload . FILE_EXTENSION_ERROR :
0 commit comments