Skip to content

Commit 198bb79

Browse files
authored
Merge pull request #37 from HaoChuan9421/master
修复Demo里的BUG
2 parents d107ab1 + 9a58aa1 commit 198bb79

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/sts-auth.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ var getTempKeys = function (callback) {
143143
Action: Action,
144144
durationSeconds: 7200,
145145
name: 'cos',
146-
policy: encodeURIComponent(policyStr),
146+
policy: encodeURIComponent(policyStr).replace(/\*/g,'%2A'),
147147
};
148148
params.Signature = util.getSignature(params, config.SecretKey, Method);
149149

@@ -162,6 +162,7 @@ var getTempKeys = function (callback) {
162162
if (body && body.data) body = body.data;
163163
tempKeysCache.credentials = body.credentials;
164164
tempKeysCache.expiredTime = body.expiredTime;
165+
tempKeysCache.policyStr = policyStr;
165166
callback(err, body);
166167
});
167168
};
@@ -197,7 +198,7 @@ app.all('/sts-auth', function (req, res, next) {
197198
SecretKey: tempKeys.credentials.tmpSecretKey,
198199
Method: req.body.method || req.query.method,
199200
Key: Key,
200-
Query: req.body.query || req.query.method || {},
201+
Query: req.body.query || req.query.query || {},
201202
Headers: req.body.headers || req.query.headers || {},
202203
};
203204
data = {
@@ -209,8 +210,7 @@ app.all('/sts-auth', function (req, res, next) {
209210
});
210211
});
211212
app.all('*', function (req, res, next) {
212-
res.writeHead(404);
213-
res.send('404 Not Found');
213+
res.status(404).send('404 Not Found');
214214
});
215215

216216
// 启动签名服务

0 commit comments

Comments
 (0)