Skip to content

Commit

Permalink
x_vars can not set to be a object
Browse files Browse the repository at this point in the history
  • Loading branch information
SunLn committed May 4, 2014
1 parent d0b79fc commit 5f216e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions demo/js/qiniu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions src/qiniu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit 5f216e9

Please sign in to comment.