diff --git a/pkg/filesystem/driver/remote/handler.go b/pkg/filesystem/driver/remote/handler.go index 3f77700..536ceb4 100644 --- a/pkg/filesystem/driver/remote/handler.go +++ b/pkg/filesystem/driver/remote/handler.go @@ -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, )