Fix: using url escape instead of unescape in remote handler (#1051)

pull/1073/head
HFO4 3 years ago
parent 7fd984f95d
commit 700e13384e

@ -153,10 +153,7 @@ func (handler Driver) Put(ctx context.Context, file io.ReadCloser, dst string, s
}
// 对文件名进行URLEncode
fileName, err := url.QueryUnescape(path.Base(dst))
if err != nil {
return err
}
fileName := url.QueryEscape(path.Base(dst))
// 决定是否要禁用文件覆盖
overwrite := "true"
@ -294,7 +291,7 @@ func (handler Driver) Source(
sourcePath := base64.RawURLEncoding.EncodeToString([]byte(path))
signedURI, err = auth.SignURI(
handler.AuthInstance,
fmt.Sprintf("%s/%d/%s/%s", controller, speed, sourcePath, fileName),
fmt.Sprintf("%s/%d/%s/%s", controller, speed, sourcePath, url.PathEscape(fileName)),
ttl,
)

Loading…
Cancel
Save