From 5f216e91892ec2eda2d6d4629ecc0126454781c1 Mon Sep 17 00:00:00 2001 From: SunLn Date: Sun, 4 May 2014 11:35:38 +0800 Subject: [PATCH] x_vars can not set to be a object --- README.md | 2 +- demo/js/qiniu.js | 5 +++-- src/qiniu.js | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8482b5c0..2bd88d6a 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ qiniu-js-sdk // 'time' : function(up,file) { // var time = (new Date()).getTime(); // do something with 'time' - // returnt time; + // return time; // }, // 'size' : function(up,file) { // var size = file.size; diff --git a/demo/js/qiniu.js b/demo/js/qiniu.js index 10399ab4..6eabeaa9 100644 --- a/demo/js/qiniu.js +++ b/demo/js/qiniu.js @@ -350,7 +350,7 @@ function QiniuJsSDK() { if (x_vars.hasOwnProperty(x_key)) { if (typeof x_vars[x_key] === 'function') { multipart_params_obj['x:' + x_key] = x_vars[x_key](up, file); - } else if (typeof x_vars[x_key] === 'string') { + } else if (typeof x_vars[x_key] !== 'object') { multipart_params_obj['x:' + x_key] = x_vars[x_key]; } } @@ -507,7 +507,7 @@ function QiniuJsSDK() { if (x_vars.hasOwnProperty(x_key)) { if (typeof x_vars[x_key] === 'function') { x_val = that.URLSafeBase64Encode(x_vars[x_key](up, file)); - } else if (typeof x_vars[x_key] === 'string') { + } else if (typeof x_vars[x_key] !== 'object') { x_val = that.URLSafeBase64Encode(x_vars[x_key]); } x_vars_url += '/x:' + x_key + '/' + x_val; @@ -525,6 +525,7 @@ function QiniuJsSDK() { if (ajax.readyState === 4) { if (ajax.status === 200) { var info = ajax.responseText; + if (FileUploaded_Handler) { FileUploaded_Handler(up, file, info); } diff --git a/src/qiniu.js b/src/qiniu.js index 10399ab4..6eabeaa9 100644 --- a/src/qiniu.js +++ b/src/qiniu.js @@ -350,7 +350,7 @@ function QiniuJsSDK() { if (x_vars.hasOwnProperty(x_key)) { if (typeof x_vars[x_key] === 'function') { multipart_params_obj['x:' + x_key] = x_vars[x_key](up, file); - } else if (typeof x_vars[x_key] === 'string') { + } else if (typeof x_vars[x_key] !== 'object') { multipart_params_obj['x:' + x_key] = x_vars[x_key]; } } @@ -507,7 +507,7 @@ function QiniuJsSDK() { if (x_vars.hasOwnProperty(x_key)) { if (typeof x_vars[x_key] === 'function') { x_val = that.URLSafeBase64Encode(x_vars[x_key](up, file)); - } else if (typeof x_vars[x_key] === 'string') { + } else if (typeof x_vars[x_key] !== 'object') { x_val = that.URLSafeBase64Encode(x_vars[x_key]); } x_vars_url += '/x:' + x_key + '/' + x_val; @@ -525,6 +525,7 @@ function QiniuJsSDK() { if (ajax.readyState === 4) { if (ajax.status === 200) { var info = ajax.responseText; + if (FileUploaded_Handler) { FileUploaded_Handler(up, file, info); }