@@ -263,7 +263,7 @@ function QiniuJsSDK() {
263263 // qiniu service max_chunk_size is 4m
264264 // reset chunk_size to max_chunk_size(4m) when chunk_size > 4m
265265 }
266- }
266+ } ;
267267 reset_chunk_size ( ) ;
268268
269269 var getUpToken = function ( ) {
@@ -287,7 +287,8 @@ function QiniuJsSDK() {
287287 var key = '' ,
288288 unique_names = false ;
289289 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 ) ;
291292 if ( unique_names ) {
292293 var ext = that . getFileExtension ( file . name ) ;
293294 key = ext ? file . id + '.' + ext : file . id ;
@@ -315,7 +316,8 @@ function QiniuJsSDK() {
315316 uploader . init ( ) ;
316317
317318 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 ) ;
319321 if ( auto_start ) {
320322 $ . each ( files , function ( i , file ) {
321323 up . start ( ) ;
@@ -351,7 +353,8 @@ function QiniuJsSDK() {
351353 } ;
352354
353355
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 ) ;
355358
356359 if ( uploader . runtime === 'html5' && chunk_size ) {
357360 if ( file . size < chunk_size ) {
@@ -379,8 +382,8 @@ function QiniuJsSDK() {
379382
380383 ctx = ctx ? ctx + ',' + res . ctx : res . ctx ;
381384 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 ) ;
384387 if ( leftSize < chunk_size ) {
385388 up . setOption ( {
386389 'url' : 'http://up.qiniu.com/mkblk/' + leftSize
@@ -399,7 +402,8 @@ function QiniuJsSDK() {
399402 errTip = '上传失败。请稍后再试。' ;
400403 break ;
401404 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 ) ;
403407 errTip = '浏览器最大可上传' + max_file_size + '。更大文件请使用命令行工具。' ;
404408 break ;
405409 case plupload . FILE_EXTENSION_ERROR :
0 commit comments