Skip to content

Commit

Permalink
modify get acl
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Jul 4, 2017
1 parent 19ec2d2 commit 8020b23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
4 changes: 2 additions & 2 deletions dist/cos-js-sdk-v5.js

Large diffs are not rendered by default.

31 changes: 7 additions & 24 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,10 @@ function getBucketACL(params, callback) {
if (err) {
return callback(err);
}

data = data || {};

var Grant = util.clone(data.AccessControlPolicy.AccessControlList.Grant || []);

if (!(Grant instanceof Array)) {
Grant = [Grant];
}

delete data.AccessControlPolicy.AccessControlList.Grant;
data.AccessControlPolicy.AccessControlList.Grants = Grant;

callback(null, data.AccessControlPolicy || {});
var Owner = data.AccessControlPolicy.Owner || {};
var Grant = data.AccessControlPolicy.AccessControlList.Grant || [];
Grant = util.isArray(Grant) ? Grant : [Grant];
callback(null, {Owner: Owner, Grants: Grant});
});
}

Expand Down Expand Up @@ -907,18 +898,10 @@ function getObjectACL(params, callback) {
if (err) {
return callback(err);
}

data = data || {};

var Owner = data.AccessControlPolicy.Owner || {};
var Grant = data.AccessControlPolicy.AccessControlList.Grant || [];

if (!(Grant instanceof Array)) {
Grant = [Grant];
}

delete data.AccessControlPolicy.AccessControlList.Grant;
data.AccessControlPolicy.AccessControlList.Grants = Grant;
callback(null, data.AccessControlPolicy || {});
Grant = util.isArray(Grant) ? Grant : [Grant];
callback(null, {Owner: Owner, Grants: Grant});
});
}

Expand Down

0 comments on commit 8020b23

Please sign in to comment.