Closed ertuil closed 10 months ago
Issue is not in English. It has been translated automatically.
Title: Object storage access has incorrect access to URLs containing Chinese characters.
During use, it was found that moememos may have incorrectly processed URL requests containing Chinese characters (or unicode) and double-encoded the '%' symbol:
Correct url: <OSS access point>/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%.png
Error URL sent by MoeMemos: <OSS access point>/%25E5%25B1%258F%25E5%25B9%2595%25E6%2588%25AA%25E5%259B%25BE%.png
It is suspected that ‘%’ is encoded again as %25
Please provide your Memos server version and examples of the externalLink
field in your /api/v1/resource
response.
Moe Memos does re-encode parts of externalLink
due to the lack of proper URL encoding in Memos API, which I can still reproduce with Memos 0.18.2 and object storage service.
The response of /api/v1/resource
in my Memos instance is:
[
{
...
"externalLink": "https://<oss access point>/2024/01/1705950677_测试.jpeg"
...
}
]
I am now using Memos 0.18.2
, and my externalLink would be:
"externalLink": "https://<oss access point>/uploads/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%202024-01-19%20105653.png"
I am using Aliyun OSS, it seems that Aliyun OSS will convert the URLs automatically. For example, if I upload a file named "测试.png" (even not using Memos), the returned access URL will be:
https://<oss access point>/%E6%B5%8B%E8%AF%95.jpg
Thank you for providing the information!
I've figured out that it relates to how Memos writes ExternalLink
differently based on whether "URL Prefix" is used in the storage settings or not.
I'll remove the additional URL encoding in Moe Memos and separately open an issue/pull request in the Memos repository to add percent-encoding for ExternalLink
when "URL Prefix" is used.
在使用中发现,moememos可能存在对含有中文字符(或unicode)的url请求处理不正确,对‘%’符号进行了双重编码:
正确的url:
<OSS接入点>/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%.png
MoeMemos 发出的错误URL:<OSS接入点>/%25E5%25B1%258F%25E5%25B9%2595%25E6%2588%25AA%25E5%259B%25BE%.png
疑似将‘%’ 再次编码为 %25