From 79e9f0da10f61dbf0c600eba4048941adcccc355 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Tue, 8 Mar 2022 11:11:48 +0800 Subject: [PATCH 1/2] #1352 fix bug --- routers/repo/attachment.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index bc843c555..9de16ba2d 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -512,6 +512,10 @@ func GetSuccessChunks(ctx *context.Context) { return } } else { + oldAttachment, _ := models.GetAttachmentByUUID(fileChunk.UUID) + if oldAttachment != nil { + fileName = oldAttachment.Name + } isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + fileName) if err != nil { ctx.ServerError("ObsHasObject failed", err) From 281cafaa9f0bfbf3989269d19c625dd8f54f3a41 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Tue, 8 Mar 2022 11:25:10 +0800 Subject: [PATCH 2/2] #1352 fix bug --- routers/repo/attachment.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 9de16ba2d..668169110 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -512,11 +512,12 @@ func GetSuccessChunks(ctx *context.Context) { return } } else { + oldFileName := fileName oldAttachment, _ := models.GetAttachmentByUUID(fileChunk.UUID) if oldAttachment != nil { - fileName = oldAttachment.Name + oldFileName = oldAttachment.Name } - isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + fileName) + isExist, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(fileChunk.UUID) + "/" + oldFileName) if err != nil { ctx.ServerError("ObsHasObject failed", err) return