fix: 修复 POP 签名 percentEncode 使用 Unicode 字母集导致非 ASCII 字符未编码的问题
CI / lint-and-build (push) Has been cancelled
CI / lint-and-build (push) Has been cancelled
CharacterSet.alphanumerics 包含所有 Unicode 字母(阿拉伯文等),导致搜索含非 ASCII 关键词时签名不匹配。改为仅允许 ASCII 字母数字加 -_.~
This commit is contained in:
@@ -40,8 +40,7 @@ struct VODSignature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static func percentEncode(_ value: String) -> String {
|
private static func percentEncode(_ value: String) -> String {
|
||||||
var allowed = CharacterSet.alphanumerics
|
let allowed = CharacterSet(charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~")
|
||||||
allowed.insert(charactersIn: "-_.~")
|
|
||||||
return value.addingPercentEncoding(withAllowedCharacters: allowed) ?? value
|
return value.addingPercentEncoding(withAllowedCharacters: allowed) ?? value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user