From 87d08f0151e643951769e323995f1c5ed89ee200 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 01:50:17 -0400 Subject: fix: harden economy recovery, shutdown concurrency, world validation, and inventory-loss paths --- internal/admin/api_rooms_bulk.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'internal/admin/api_rooms_bulk.go') diff --git a/internal/admin/api_rooms_bulk.go b/internal/admin/api_rooms_bulk.go index d10e0e3..b9cbb4a 100644 --- a/internal/admin/api_rooms_bulk.go +++ b/internal/admin/api_rooms_bulk.go @@ -108,7 +108,12 @@ func (s *AdminServer) handleBulkEdit(w http.ResponseWriter, r *http.Request) { newPath := path if patch.Dir != nil && *patch.Dir != "" { - destDir := filepath.Join(s.dataDir, "rooms", *patch.Dir) + dir, dirErr := s.resolveRoomSubdir(*patch.Dir) + if dirErr != nil { + failJSON(w, dirErr.Error()) + return + } + destDir := filepath.Join(s.dataDir, "rooms", dir) if _, statErr := os.Stat(destDir); os.IsNotExist(statErr) { failJSON(w, fmt.Sprintf("directory does not exist: %s", *patch.Dir)) return @@ -130,6 +135,10 @@ func (s *AdminServer) handleBulkEdit(w http.ResponseWriter, r *http.Request) { failJSON(w, fmt.Sprintf("marshal room %d: %v", id, marshalErr)) return } + if err := validateRoomSchema(newContent); err != nil { + failJSON(w, fmt.Sprintf("room %d failed schema validation: %v", id, err)) + return + } writes = append(writes, roomWrite{id: id, oldPath: path, newPath: newPath, oldContent: oldContent, newContent: newContent}) } -- cgit v1.2.3