fix(s3): escape CopySource request header when copying files #7860
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复问题
#7858 :重命名或复制文件名含有中文的文件,Signature计算错误
问题原因
复制文件时,请求头部
X-Amz-Copy-Source
是源文件的路径,计算Signature
时会用到它;华为云是按转义后的CopySource
计算Signature
,而alist
没有做转义,导致签名不一致报错其实
AWS
官方也是要求做转义的,不过经过测试腾讯云对象存储COS
对两种情况都做了兼容,所以没有报错解决方案
对CopySource增加转义操作
自测
华为云-重命名含中文的文件 --- OK
华为云-重命名含中文的目录 --- OK
华为云-重命名英文的文件 --- OK
腾讯云-重命名含中文的文件 --- OK
腾讯云-重命名英文的文件 --- OK