Open
Description
服务端限制了文件的前缀, 但是使用 getAuthorization 参数的话, uploadFile 调用时 key 已经需要明确的传入了
let prefix = '';
const cos = new COS({
getAuthorization: function(options, callback) {
// 服务端获取临时凭证
prefix = resp.prefix
callback({
TmpSecretId: credentials.tmpSecretId,
TmpSecretKey: credentials.tmpSecretKey,
XCosSecurityToken: credentials.sessionToken,
ExpiredTime: data.expiredTime,
})
},
})
cos.uploadFile({
Key: makeFileKey(prefix),
})
Metadata
Metadata
Assignees
Labels
No labels