aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/undo.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/undo.go')
-rw-r--r--internal/admin/undo.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/admin/undo.go b/internal/admin/undo.go
index 7bfbe09..24ce9c1 100644
--- a/internal/admin/undo.go
+++ b/internal/admin/undo.go
@@ -9,6 +9,8 @@ import (
"strings"
"sync"
"time"
+
+ "thehouseoficarus/internal/persistence"
)
type ExtraFile struct {
@@ -537,12 +539,12 @@ func (us *UndoStack) save() {
log.Printf("undo: failed to marshal history: %v", err)
return
}
- if err := os.WriteFile(us.filePath, b, 0600); err != nil {
+ if err := persistence.WriteFile(us.filePath, b, 0600); err != nil {
log.Printf("undo: failed to write history file: %v", err)
return
}
- // os.WriteFile does not change an existing file's mode: tighten a history
- // file that a previous version created world-readable.
+ // persistence.WriteFile preserves an existing file's mode: tighten a
+ // history file that a previous version created world-readable.
if err := os.Chmod(us.filePath, 0600); err != nil {
log.Printf("undo: failed to secure history file: %v", err)
}