From 003c87bf00cd7363bca8947387ac99b78beaa9ab Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:54:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=80=BB=E8=BE=91=EF=BC=8C=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E7=A9=BA=E9=97=B4=E5=8D=A0=E7=94=A8=20(#5508?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/5184 --- backend/app/api/v1/file.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/app/api/v1/file.go b/backend/app/api/v1/file.go index 34eefc05b..19b44eb57 100644 --- a/backend/app/api/v1/file.go +++ b/backend/app/api/v1/file.go @@ -593,6 +593,10 @@ func (b *BaseApi) Size(c *gin.Context) { } func mergeChunks(fileName string, fileDir string, dstDir string, chunkCount int, overwrite bool) error { + defer func() { + _ = os.RemoveAll(fileDir) + }() + op := files.NewFileOp() dstDir = strings.TrimSpace(dstDir) mode, _ := files.GetParentMode(dstDir) @@ -629,9 +633,10 @@ func mergeChunks(fileName string, fileDir string, dstDir string, chunkCount int, if err != nil { return err } + _ = os.Remove(chunkPath) } - return files.NewFileOp().DeleteDir(fileDir) + return nil } // @Tags File