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

[BUG] update reqParams to support non-ISO-8859-1 encoded file name #163

Closed
xiangcheng09 opened this issue Dec 2, 2024 · 0 comments · Fixed by #164
Closed

[BUG] update reqParams to support non-ISO-8859-1 encoded file name #163

xiangcheng09 opened this issue Dec 2, 2024 · 0 comments · Fixed by #164

Comments

@xiangcheng09
Copy link
Contributor

xiangcheng09 commented Dec 2, 2024

OpenIM Server Version

release-v3.8

Operating System and CPU Architecture

Windows (AMD)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

现象:使用AWS替换了minio以后,可以上传图片、文件到S3。但是如果文件名包含英文以外的字符,比如说中文、日语,就会发生不能下载的问题。如下图所示,openIM生成的AWS S3下载链接点击以后的效果:
error picture
requestHeader

原因:AWS读取response-content-disposition时,默认是ISO-8859-1编码,如果文件名包含中文/日文等则解析失败。因为需要修改Header代码,声明使用UTF-8编码。

修改方案:openIM是在后端生成的AWS签名地址,所以需要在后端修改reqParam。我根据参考资料的内容,修改了response-content-disposition的值,修改完毕后可以正常点击链接下载AWS S3文件了。
(注:url.PathEscape(opt.Filename)可能不是最好的方法,但是可以解决这个问题。如果有更好的方法,请告诉我,万分感谢)

参考资料:
[1]https://blog.csdn.net/KenkoTech/article/details/141195210
[2]https://qiita.com/nkmryu/items/10cae19e7e0f0b5ededc

其它事项:
另外,使用AWS S3替换minio库时有一个文件不能上传的问题,那个PR的地址放在这里。
PR地址:minio/minio-go#2019
如果minio-go最终merge到了主分支,请也同步更新一下open-im-server的依赖。

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 a pull request may close this issue.

1 participant