mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-25 08:25:07 +03:00
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:
parent
09f600c6cf
commit
8e44b57879
5 changed files with 0 additions and 22 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue