Skip to content

Commit 9dc7f54

Browse files
committed
支持 / 开头的 path
1 parent 3f26c71 commit 9dc7f54

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sdk/util.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,6 @@ var apiWrapper = function (apiName, apiFn) {
241241
callback({error: 'lack of required params'});
242242
return;
243243
}
244-
// 优化 Key 参数
245-
if (params.Key && params.Key.indexOf('/') === 0) {
246-
callback({error: 'params Key can not start width "/"'});
247-
return;
248-
}
249244
// 判断 region 格式
250245
if (params.Region && regionMap[params.Region]) {
251246
callback({error: 'Region error, it should be ' + regionMap[params.Region]});
@@ -260,6 +255,10 @@ var apiWrapper = function (apiName, apiFn) {
260255
params.AppId = appId;
261256
params.Bucket = bucket;
262257
}
258+
// 兼容带有斜杠开头的 Key
259+
if (params.Key && params.Key.substr(0, 1) === '/') {
260+
params.Key = params.Key.substr(1);
261+
}
263262
}
264263
var res = apiFn.call(this, params, callback);
265264
if (apiName === 'getAuth') {

0 commit comments

Comments
 (0)