From e7e051851752910e8ccc8f5f26f103a07c591daa Mon Sep 17 00:00:00 2001 From: wht <101807499+OutOfEastGate@users.noreply.github.com> Date: Tue, 7 Feb 2023 23:26:17 +0800 Subject: [PATCH] feat: fix the upload file name contains space problem (#1527) --- object/storage.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/object/storage.go b/object/storage.go index 7b42d1b2..6f6c5e1d 100644 --- a/object/storage.go +++ b/object/storage.go @@ -72,17 +72,17 @@ func GetUploadFileUrl(provider *Provider, fullFilePath string, hasTimestamp bool if provider.Type == "Azure Blob" { host = util.UrlJoin(host, provider.Bucket) } - fileUrl := "" - if provider.Type == "Tencent Cloud COS" { - fileUrl = util.UrlJoin(host, objectKey) - } else { - fileUrl = util.UrlJoin(host, escapePath(objectKey)) - } + + fileUrl := util.UrlJoin(host, escapePath(objectKey)) if hasTimestamp { fileUrl = fmt.Sprintf("%s?t=%s", fileUrl, util.GetCurrentUnixTime()) } + if provider.Type == "Tencent Cloud COS" { + objectKey = escapePath(objectKey) + } + return fileUrl, objectKey }