From c0f7214cdb9166c078a4680778ed24a0a6e45135 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Mon, 22 Mar 2021 16:22:21 +0800 Subject: [PATCH] Revert "Fix: OSS SDK will encode all object key (#694)" This reverts commit 270f617b and fix #802 --- .gitignore | 1 - assets | 2 +- pkg/filesystem/file.go | 11 ++++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 2acda62..40a5587 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,3 @@ version.lock *.ini conf/conf.ini /statik/ -/vendor/ \ No newline at end of file diff --git a/assets b/assets index 35c5966..51c246e 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 35c5966f66cd0b67fbd2a3f828ce256302316c17 +Subproject commit 51c246ef02e248259ddcf4c2d90e0c5a1af11a48 diff --git a/pkg/filesystem/file.go b/pkg/filesystem/file.go index 8216779..aee0afe 100644 --- a/pkg/filesystem/file.go +++ b/pkg/filesystem/file.go @@ -2,6 +2,8 @@ package filesystem import ( "context" + "io" + model "github.com/cloudreve/Cloudreve/v3/models" "github.com/cloudreve/Cloudreve/v3/pkg/conf" "github.com/cloudreve/Cloudreve/v3/pkg/filesystem/fsctx" @@ -9,8 +11,6 @@ import ( "github.com/cloudreve/Cloudreve/v3/pkg/serializer" "github.com/cloudreve/Cloudreve/v3/pkg/util" "github.com/juju/ratelimit" - "io" - "net/url" ) /* ============ @@ -289,11 +289,8 @@ func (fs *FileSystem) SignURL(ctx context.Context, file *model.File, ttl int64, if err != nil { return "", serializer.NewError(serializer.CodeNotSet, "无法获取外链", err) } - // 阿里云的 golang SDK 会把整个object KEY也编码 临时解决方案是清空`RawPath`让golang的`url.EscapedPath`修正这个问题 - // https://github.com/cloudreve/Cloudreve/issues/677 https://github.com/aliyun/aliyun-oss-go-sdk/blob/6f7e8f88c64181cc2d86d8bd46090b68851e645a/oss/conn.go#L767 - sourceUrl, _ := url.Parse(source) - sourceUrl.RawPath = "" - return sourceUrl.String(), nil + + return source, nil } // ResetFileIfNotExist 重设当前目标文件为 path,如果当前目标为空