Skip to content

Commit 2e3981d

Browse files
committed
Merge pull request #47 from xushiwei/feature/doc-2.4.2
remove auth.GetPolicy.scope default value
2 parents 957796b + dfe02d3 commit 2e3981d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

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

3+
## v2.4.2
4+
5+
Issue [#48](https://github.com/qiniu/nodejs-sdk/pull/48):
6+
7+
- 去除 auth.GetPolicy.scope 的默认值:"*/*"
8+
9+
Issue [#46](https://github.com/qiniu/nodejs-sdk/pull/46):
10+
11+
- 更新 v2.4.1 的文档(docs/README.md)
12+
13+
314
## v2.4.1
415

516
2013-02-09

lib/auth.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ function PutPolicy(opts) {
4747

4848
PutPolicy.prototype.token = function() {
4949
var params = {
50-
"deadline": this.expires + Math.floor(Date.now() / 1000),
51-
"escape": this.excape,
50+
"deadline": this.expires + Math.floor(Date.now() / 1000)
5251
};
5352
if (this.scope !== null) {
5453
params["scope"] = this.scope;
@@ -65,6 +64,9 @@ PutPolicy.prototype.token = function() {
6564
if (this.asyncOps !== null) {
6665
params["asyncOps"] = this.asyncOps;
6766
}
67+
if (this.escape) {
68+
params["escape"] = this.excape;
69+
}
6870
return generateToken(params);
6971
};
7072

@@ -73,7 +75,7 @@ PutPolicy.prototype.token = function() {
7375

7476
function GetPolicy(opts) {
7577
this.expires = opts.expires || 3600;
76-
this.scope = opts.scope || "*/*";
78+
this.scope = opts.scope; // GetPolicy.scope 没有默认值:用 "*/*" 访问权限太高!
7779
}
7880

7981
GetPolicy.prototype.token = function() {

0 commit comments

Comments
 (0)