From 6597caaf05788e5dee958d0291d38f4fa57bd25b Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:41:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=BF=AB=E7=85=A7?= =?UTF-8?q?=E5=A5=97=E6=8E=A5=E5=AD=97=E5=BF=BD=E7=95=A5=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#6273)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/snapshot_create.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/app/service/snapshot_create.go b/backend/app/service/snapshot_create.go index 705d4804e..65ea464b3 100644 --- a/backend/app/service/snapshot_create.go +++ b/backend/app/service/snapshot_create.go @@ -6,7 +6,6 @@ import ( "fmt" "os" "path" - pathUtils "path" "regexp" "strings" "sync" @@ -260,11 +259,7 @@ func handleSnapTar(sourceDir, targetDir, name, exclusionRules string, secret str commands = fmt.Sprintf("tar --warning=no-file-changed --ignore-failed-read --exclude-from=<(find %s -type s -print) -zcf %s %s %s %s", sourceDir, " -"+exStr, path, extraCmd, targetDir+"/"+name) global.LOG.Debug(strings.ReplaceAll(commands, fmt.Sprintf(" %s ", secret), "******")) } else { - itemPrefix := pathUtils.Base(sourceDir) - if itemPrefix == "/" { - itemPrefix = "" - } - commands = fmt.Sprintf("tar --warning=no-file-changed --ignore-failed-read --exclude-from=<(find %s -type s -printf '%s' | sed 's|^|%s/|') -zcf %s %s -C %s .", sourceDir, "%P\n", itemPrefix, targetDir+"/"+name, exStr, sourceDir) + commands = fmt.Sprintf("tar --warning=no-file-changed --ignore-failed-read --exclude-from=<(find %s -type s -printf '%s' | sed 's|^|./|') -zcf %s %s -C %s .", sourceDir, "%P\n", targetDir+"/"+name, exStr, sourceDir) global.LOG.Debug(commands) } stdout, err := cmd.ExecWithTimeOut(commands, 30*time.Minute)