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

七牛签名错误 #6

Open
dark3212 opened this issue Dec 12, 2019 · 3 comments
Open

七牛签名错误 #6

dark3212 opened this issue Dec 12, 2019 · 3 comments

Comments

@dark3212
Copy link

七牛上传计算签名官方推荐使用URL安全的Base64编码。
现在的Base64编码方式得到的计算结果如果包含“+”或“/”会导致401签名错误。
详见七牛官方文档:https://developer.qiniu.com/kodo/manual/1231/appendix#urlsafe-base64
需要将字符串中的加号+换成中划线-,并且将斜杠/换成下划线_

我的做法比较懒,是将upload.js 361行添加.replace(/+/g, "-").replace(///g, "_");

@Thobian
Copy link
Owner

Thobian commented Dec 12, 2019

谢谢,收到反馈。
编写时测试不是很充分,后续修复这个问题。

@Acc2020
Copy link

Acc2020 commented Mar 22, 2020

@dark3212, 你的修改方式有错误,/ 和 + 都需要转义修改,两个特殊字符需要进行转义,uploadToken = uploadToken.replace(/+/g, "-").replace(///g, "_");

@ffrankfeng
Copy link

@dark3212, 你的修改方式有错误,/ 和 + 都需要转义修改,两个特殊字符需要进行转义,uploadToken = uploadToken.replace(/+/g, "-").replace(///g, "_");

这样做好像还是不行啊

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

No branches or pull requests

4 participants