Remove backup creation logic from SaveConfig function and update related documentation. Adjust WebUIServer response structure and translations to reflect the absence of backup path information.

This commit is contained in:
Andy Oknen 2025-08-15 20:25:29 +00:00
parent 09f600c6cf
commit 8e44b57879
5 changed files with 0 additions and 22 deletions

View file

@ -521,23 +521,6 @@ func SaveConfig(configData interface{}, configPath, format string) error {
}
}
// Create backup if file exists
if _, err := os.Stat(targetPath); err == nil { // Path already validated above
backupPath := targetPath + ".backup"
// Validate backup path as well
validatedBackupPath, err := validateConfigPath(backupPath)
if err != nil {
return fmt.Errorf("invalid backup path: %v", err)
}
backupPath = validatedBackupPath
if data, err := os.ReadFile(targetPath); err == nil { // Path already validated above
if err := os.WriteFile(backupPath, data, 0600); err != nil { // Path already validated above
return fmt.Errorf("failed to create backup: %v", err)
}
}
}
// Ensure directory exists
dir := filepath.Dir(targetPath)
// Clean the directory path as well