Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复从 token 解析 bucket 的 bug & 完善下类型 & fix issue #456

Merged
merged 5 commits into from Jun 30, 2020

Conversation

winddies
Copy link
Contributor

@winddies winddies commented Jun 29, 2020

  • 由于 ecloud 里 token 加入了 uid 等参数,所以实际格式并不是两个冒号,token 冒号分割后解析 bucket 时,应该取最后的解析
    image

企业微信截图_20db6ea8-aaf4-4852-8b48-2cd5b3df59a3

* 完善下 observable 文件中的类型 * 增加 base64 编解码函数的导出 fix #455

nighca
nighca previously approved these changes Jun 29, 2020
Copy link
Contributor

@nighca nighca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐺

@winddies winddies changed the title 修复从 token 解析 bucket 的 bug 修复从 token 解析 bucket 的 bug & 完善下类型 Jun 30, 2020
@winddies winddies changed the title 修复从 token 解析 bucket 的 bug & 完善下类型 修复从 token 解析 bucket 的 bug & 完善下类型 & fix issue Jun 30, 2020
src/observable.ts Show resolved Hide resolved
Comment on lines +131 to +133
} catch (e) {
this.onError(e)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个异常应该不重新 throw 出去吗? @nighca

src/utils.ts Outdated
@@ -273,7 +273,7 @@ interface PutPolicy {
export function getPutPolicy(token: string) {
const segments = token.split(':')
const ak = segments[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要不要写一下文档链接或格式注释

Comment on lines +275 to +277
// token 构造的差异参考:https://github.com/qbox/product/blob/master/kodo/auths/UpToken.md#admin-uptoken-authorization
const ak = segments.length > 3 ? segments[1] : segments[0]
const putPolicy: PutPolicy = JSON.parse(urlSafeBase64Decode(segments[segments.length - 1]))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nighca = =…

Copy link
Collaborator

@lzfee0227 lzfee0227 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l g t m

@lzfee0227 lzfee0227 merged commit 54557c0 into qiniu:master Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

请增加urlSafeBase64Encode的导出。
3 participants