Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#CHANGELOG

## v2.4.3

2013-02-22

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

- 去除对自定义 generateQueryString() 函数的依赖,使用 querystring 包的 stringify() 函数。
- auth.PutPolicy 增加对 returnBody 的支持,用户可自定义上传完文件后的返回值。

## v2.4.2

Issue [#48](https://github.com/qiniu/nodejs-sdk/pull/48):
Expand Down
4 changes: 4 additions & 0 deletions lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function PutPolicy(opts) {
this.customer = opts.customer || null;
this.escape = opts.escape || 0;
this.asyncOps = opts.asyncOps || null;
this.returnBody = opts.returnBody || null;
}

PutPolicy.prototype.token = function() {
Expand All @@ -67,6 +68,9 @@ PutPolicy.prototype.token = function() {
if (this.escape) {
params["escape"] = this.excape;
}
if (this.returnBody !== null) {
params["returnBody"] = this.returnBody;
}
return generateToken(params);
};

Expand Down
3 changes: 2 additions & 1 deletion lib/rs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var path = require('path');
var crc32 = require('crc32');
var mime = require('mime');
var formstream = require('formstream');
var querystring = require('querystring');
var config = require('./conf.js');
var util = require('./util.js');
var img = require('./img.js');
Expand Down Expand Up @@ -135,7 +136,7 @@ Service.prototype.uploadWithToken = function(uploadToken, stream, key, mimeType,
"mime_type": mimeType
};
}
var callbackQueryString = util.generateQueryString(callbackParams);
var callbackQueryString = querystring.stringify(callbackParams);
var url = config.UP_HOST + "/upload";

var filename = path.basename(key);
Expand Down
15 changes: 0 additions & 15 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,6 @@ exports.generateActionString = function(bucket, key, mimeType, customMeta, crc32
return actionParams;
}

exports.generateQueryString = function (params) {
if (params.constructor === String) {
return params;
}
var total_params = [];
for (var key in params) {
total_params.push(escape(key) + "=" + escape(params[key]));
}
if (total_params.length > 0) {
return total_params.join("&");
} else {
return "";
}
}

// ------------------------------------------------------------------------------------------
// func readAll

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qiniu",
"version": "2.4.2",
"version": "2.4.3",
"description": "Node wrapper for Qiniu Resource (Cloud) Storage API",
"main": "index.js",
"directories": {
Expand Down