fix: 解决应用备份或升级失败的问题 (#1306)

This commit is contained in:
ssongliu 2023-06-09 11:42:11 +08:00 committed by GitHub
parent 8f036a0c3d
commit 7c600a357c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -99,7 +99,7 @@ func handleAppBackup(install *model.AppInstall, backupDir, fileName string) erro
return err
}
appPath := fmt.Sprintf("%s/%s", install.GetPath(), install.Name)
appPath := install.GetPath()
if err := handleTar(appPath, tmpDir, "app.tar.gz", ""); err != nil {
return err
}

View File

@ -196,7 +196,7 @@ func handleTar(sourceDir, targetDir, name, exclusionRules string) error {
path := ""
if strings.Contains(sourceDir, "/") {
itemDir := strings.ReplaceAll(sourceDir[strings.LastIndex(sourceDir, "/"):], "/", "")
aheadDir := strings.ReplaceAll(sourceDir, itemDir, "")
aheadDir := sourceDir[:strings.LastIndex(sourceDir, "/")]
path += fmt.Sprintf("-C %s %s", aheadDir, itemDir)
} else {
path = sourceDir