From a0af04bbf7d9685ae27f72b2a5805eee28a8e5f6 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Tue, 27 Feb 2024 10:20:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=BF=AB=E7=85=A7?= =?UTF-8?q?=E5=9B=9E=E6=BB=9A=E9=80=BB=E8=BE=91=20(#3989)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/snapshot.go | 11 ++++++----- frontend/src/views/container/image/prune/index.vue | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/app/service/snapshot.go b/backend/app/service/snapshot.go index 203267415..1b57a484d 100644 --- a/backend/app/service/snapshot.go +++ b/backend/app/service/snapshot.go @@ -337,13 +337,14 @@ func (u *SnapshotService) SnapshotRollback(req dto.SnapshotRecover) error { defer func() { global.Cron.Start() }() - snapJson, err := u.readFromJson(fmt.Sprintf("%s/snapshot.json", rootDir)) - if err != nil { - updateRollbackStatus(snap.ID, constant.StatusFailed, fmt.Sprintf("decompress file failed, err: %v", err)) + + u.OriginalPath = fmt.Sprintf("%s/1panel_original/original_%s", global.CONF.System.BaseDir, snap.Name) + if _, err := os.Stat(u.OriginalPath); err != nil && os.IsNotExist(err) { return } - u.OriginalPath = fmt.Sprintf("%s/1panel_original/original_%s", snapJson.OldBaseDir, snap.Name) - if _, err := os.Stat(u.OriginalPath); err != nil && os.IsNotExist(err) { + snapJson, err := u.readFromJson(fmt.Sprintf("%s/snapshot.json", u.OriginalPath)) + if err != nil { + updateRollbackStatus(snap.ID, constant.StatusFailed, fmt.Sprintf("read snapjson file failed, err: %v", err)) return } diff --git a/frontend/src/views/container/image/prune/index.vue b/frontend/src/views/container/image/prune/index.vue index 9fafbe13d..884e9ee2e 100644 --- a/frontend/src/views/container/image/prune/index.vue +++ b/frontend/src/views/container/image/prune/index.vue @@ -22,7 +22,7 @@