aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_files.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 20:03:13 -0400
committerhistoria <[not public]>2026-09-18 20:03:13 -0400
commit79764732406d6484f67d3dec045483dcb5d08c28 (patch)
tree7a64e8581a540b97ed554f5723e2d587424ab1c6 /internal/admin/api_files.go
parentf1e461ab6aec6b9bf056bbe2daa88a251e0f21da (diff)
downloadthehouseoficarus-79764732406d6484f67d3dec045483dcb5d08c28.tar.gz
feat: better card ascii art
Diffstat (limited to 'internal/admin/api_files.go')
-rw-r--r--internal/admin/api_files.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/admin/api_files.go b/internal/admin/api_files.go
index 2aa0e5f..b9f54c5 100644
--- a/internal/admin/api_files.go
+++ b/internal/admin/api_files.go
@@ -227,9 +227,10 @@ func (s *AdminServer) handleFiles(w http.ResponseWriter, r *http.Request) {
// writing, so the raw editor can never disclose or overwrite it.
body = restoreAccountSecret(relPath, fullPath, body)
- var oldContent []byte
- if existing, err := snapshotFile(fullPath); err == nil {
- oldContent = existing
+ oldContent, existed, err := snapshotBefore(fullPath)
+ if err != nil {
+ failJSON(w, "read existing file: "+err.Error())
+ return
}
dir := filepath.Dir(fullPath)
@@ -243,7 +244,7 @@ func (s *AdminServer) handleFiles(w http.ResponseWriter, r *http.Request) {
return
}
- isCreate := oldContent == nil
+ isCreate := !existed
desc := "Updated file " + relPath
if isCreate {
desc = "Created file " + relPath