diff options
| author | historia <[not public]> | 2026-10-05 18:16:47 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-05 18:16:47 -0400 |
| commit | 9d8c43cd68c960b9a6b8f781684f763e204a4498 (patch) | |
| tree | c9e2a02094a8700db29db2768a0d058ce259a4f4 /internal/admin/api_rooms.go | |
| parent | 7a15a5d70004b28bf2a710fa0f536af2446e5b17 (diff) | |
| download | thehouseoficarus-9d8c43cd68c960b9a6b8f781684f763e204a4498.tar.gz | |
fix: shared YAML encoder and journal directory, text cleanup
Diffstat (limited to 'internal/admin/api_rooms.go')
| -rw-r--r-- | internal/admin/api_rooms.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/admin/api_rooms.go b/internal/admin/api_rooms.go index 76db231..06e736c 100644 --- a/internal/admin/api_rooms.go +++ b/internal/admin/api_rooms.go @@ -726,7 +726,7 @@ func (s *AdminServer) handleRoomLink(w http.ResponseWriter, r *http.Request) { // Both sides are resolved and serialized before any write, and both // are applied in one journaled transaction so a failure cannot leave // an asymmetric link, and one Undo reverses the whole action. - txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal")) + txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir)) if err := txn.Replace(pathA, newA, 0644); err != nil { writeJSONError(w, "write A: "+err.Error(), http.StatusInternalServerError) return @@ -868,7 +868,7 @@ func (s *AdminServer) handleRoomLink(w http.ResponseWriter, r *http.Request) { } if len(writes) > 0 { - txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal")) + txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir)) for _, wr := range writes { if err := txn.Replace(wr.path, wr.data, 0644); err != nil { writeJSONError(w, "plan unlink: "+err.Error(), http.StatusInternalServerError) @@ -932,7 +932,7 @@ func (s *AdminServer) handleRoomMove(w http.ResponseWriter, r *http.Request) { } // Move the file in one journaled transaction: a failed destination write // or source removal must not leave the same room ID in two directories. - txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal")) + txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir)) if err := txn.Move(oldPath, newPath); err != nil { failJSON(w, "plan move: "+err.Error()) return @@ -1054,7 +1054,7 @@ func (s *AdminServer) handleRoomRename(w http.ResponseWriter, r *http.Request) { } // ---- Apply the file changes as one journal transaction. ---- - txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal")) + txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir)) if err := txn.Move(oldPath, newPath); err != nil { writeJSONError(w, "plan move: "+err.Error(), http.StatusInternalServerError) return @@ -1240,7 +1240,7 @@ func (s *AdminServer) handleRoomSwap(w http.ResponseWriter, r *http.Request) { // Apply both files in one journaled transaction so a failure cannot leave // the two rooms half-swapped. - txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal")) + txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir)) if err := txn.Replace(aPath, newAContent, 0644); err != nil { writeJSONError(w, "plan write A: "+err.Error(), http.StatusInternalServerError) return @@ -1393,7 +1393,7 @@ func (s *AdminServer) handleResolveDuplicate(w http.ResponseWriter, r *http.Requ } // Move + rewrite in one journaled transaction so a failure cannot // leave the same ID in two directories. - txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal")) + txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir)) if err := txn.Move(absPath, newRel); err != nil { failJSON(w, "plan rename failed: "+err.Error()) return |
