fix: improve database file handling (#14043)

This commit is contained in:
ssongliu
2026-10-13 09:39:27 +08:00
committed by GitHub
parent f9c43989fe
commit bc6cf519ce
6 changed files with 62 additions and 51 deletions
+3
View File
@@ -91,6 +91,9 @@ var restoreCmd = &cobra.Command{
}
fmt.Println(i18n.GetMsgByKeyForCmd("RestoreStep4"))
if _, err := os.Stat(path.Join(tmpPath, "db")); err == nil {
if err := os.Chmod(path.Join(tmpPath, "db"), 0700); err != nil {
return err
}
dbPath := path.Join(baseDir, "1panel")
targetDBDir := path.Join(dbPath, "db")
if err := os.RemoveAll(targetDBDir); err != nil {