From ce258cf157b753b839af406a2965e82c26a34bbc Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:06:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=20Mysql=20=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=20(#1874?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/backup_app.go | 9 +++++++++ frontend/src/global/form-rules.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/app/service/backup_app.go b/backend/app/service/backup_app.go index ec00836d3..412d8f3fb 100644 --- a/backend/app/service/backup_app.go +++ b/backend/app/service/backup_app.go @@ -208,10 +208,18 @@ func handleAppRecover(install *model.AppInstall, recoverFile string, isRollback } } + appDir := install.GetPath() + backPath := fmt.Sprintf("%s_bak", appDir) + _ = fileOp.Rename(appDir, backPath) + _ = fileOp.CreateDir(appDir, 0755) + if err := handleUnTar(tmpPath+"/app.tar.gz", fmt.Sprintf("%s/%s", constant.AppInstallDir, install.App.Key)); err != nil { global.LOG.Errorf("handle recover from app.tar.gz failed, err: %v", err) + _ = fileOp.DeleteDir(appDir) + _ = fileOp.Rename(backPath, appDir) return err } + _ = fileOp.DeleteDir(backPath) if len(newEnvFile) != 0 { envPath := fmt.Sprintf("%s/%s/%s/.env", constant.AppInstallDir, install.App.Key, install.Name) @@ -233,6 +241,7 @@ func handleAppRecover(install *model.AppInstall, recoverFile string, isRollback return err } isOk = true + return nil } diff --git a/frontend/src/global/form-rules.ts b/frontend/src/global/form-rules.ts index 767c94004..0e7e2d665 100644 --- a/frontend/src/global/form-rules.ts +++ b/frontend/src/global/form-rules.ts @@ -124,7 +124,7 @@ const checkSimpleName = (rule: any, value: any, callback: any) => { if (value === '' || typeof value === 'undefined' || value == null) { callback(new Error(i18n.global.t('commons.rule.simpleName'))); } else { - const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_]{0,30}$/; + const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_]{1,29}$/; if (!reg.test(value) && value !== '') { callback(new Error(i18n.global.t('commons.rule.simpleName'))); } else {