Skip to content

Commit 90a16aa

Browse files
committed
Merge pull request #54 from qiniu/develop
Release v2.4.3
2 parents 5f833e6 + abfafac commit 90a16aa

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#CHANGELOG
22

3+
## v2.4.3
4+
5+
2013-02-22
6+
7+
Issue [#54](https://github.com/qiniu/nodejs-sdk/pull/54):
8+
9+
- 去除对自定义 generateQueryString() 函数的依赖,使用 querystring 包的 stringify() 函数。
10+
- auth.PutPolicy 增加对 returnBody 的支持,用户可自定义上传完文件后的返回值。
11+
312
## v2.4.2
413

514
Issue [#48](https://github.com/qiniu/nodejs-sdk/pull/48):

lib/auth.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function PutPolicy(opts) {
4343
this.customer = opts.customer || null;
4444
this.escape = opts.escape || 0;
4545
this.asyncOps = opts.asyncOps || null;
46+
this.returnBody = opts.returnBody || null;
4647
}
4748

4849
PutPolicy.prototype.token = function() {
@@ -67,6 +68,9 @@ PutPolicy.prototype.token = function() {
6768
if (this.escape) {
6869
params["escape"] = this.excape;
6970
}
71+
if (this.returnBody !== null) {
72+
params["returnBody"] = this.returnBody;
73+
}
7074
return generateToken(params);
7175
};
7276

lib/rs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var path = require('path');
33
var crc32 = require('crc32');
44
var mime = require('mime');
55
var formstream = require('formstream');
6+
var querystring = require('querystring');
67
var config = require('./conf.js');
78
var util = require('./util.js');
89
var img = require('./img.js');
@@ -135,7 +136,7 @@ Service.prototype.uploadWithToken = function(uploadToken, stream, key, mimeType,
135136
"mime_type": mimeType
136137
};
137138
}
138-
var callbackQueryString = util.generateQueryString(callbackParams);
139+
var callbackQueryString = querystring.stringify(callbackParams);
139140
var url = config.UP_HOST + "/upload";
140141

141142
var filename = path.basename(key);

lib/util.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,6 @@ exports.generateActionString = function(bucket, key, mimeType, customMeta, crc32
3434
return actionParams;
3535
}
3636

37-
exports.generateQueryString = function (params) {
38-
if (params.constructor === String) {
39-
return params;
40-
}
41-
var total_params = [];
42-
for (var key in params) {
43-
total_params.push(escape(key) + "=" + escape(params[key]));
44-
}
45-
if (total_params.length > 0) {
46-
return total_params.join("&");
47-
} else {
48-
return "";
49-
}
50-
}
51-
5237
// ------------------------------------------------------------------------------------------
5338
// func readAll
5439

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qiniu",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"description": "Node wrapper for Qiniu Resource (Cloud) Storage API",
55
"main": "index.js",
66
"directories": {

0 commit comments

Comments
 (0)