🐛 fix #533 only encode fileName

pull/548/head
Xhofe 2022-02-14 14:31:09 +08:00
parent e055ed3afa
commit fb05a6ca48
2 changed files with 11 additions and 6 deletions

View File

@ -524,7 +524,7 @@ func (driver Cloud189) NewUpload(file *model.FileStream, account *model.Account)
}
res, err := driver.UploadRequest("/person/initMultiUpload", map[string]string{
"parentFolderId": parentFile.Id,
"fileName": file.Name,
"fileName": encode(file.Name),
"fileSize": strconv.FormatInt(int64(file.Size), 10),
"sliceSize": strconv.FormatInt(int64(DEFAULT), 10),
"lazyCheck": "1",

View File

@ -115,17 +115,22 @@ func EncodeParam(v url.Values) string {
}
buf.WriteString(k)
buf.WriteByte('=')
buf.WriteString(encode(v))
//if k == "fileName" {
// buf.WriteString(encode(v))
//} else {
buf.WriteString(v)
//}
}
}
return buf.String()
}
func encode(str string) string {
str = strings.ReplaceAll(str, "%", "%25")
str = strings.ReplaceAll(str, "&", "%26")
str = strings.ReplaceAll(str, "+", "%2B")
return str
//str = strings.ReplaceAll(str, "%", "%25")
//str = strings.ReplaceAll(str, "&", "%26")
//str = strings.ReplaceAll(str, "+", "%2B")
//return str
return url.QueryEscape(str)
}
func AesEncrypt(data, key []byte) []byte {