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

make_policy 方法的结果没有decode('utf-8'), 导致 服务器返回decode policy error #64

Open
MusaZhou opened this issue Nov 14, 2018 · 0 comments

Comments

@MusaZhou
Copy link

采用 .modules.sign模块下的make_policy方法获得policy 并且生成签名,上传文件时服务器报错decode policy error. 发现是由于make_policy的结果没有使用decode('utf-8'),导致结果带一个b前缀,造成服务端解码错误。测试将make_policy方法改为

def make_policy(data):
      policy = json.dumps(data);
      return base64.b64encode(b(policy)).decode()

可以成功调用。
另外在FormUpload类中的upload方法,data字典里的key 'service' 应该改为 'bucket'

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

1 participant