From 7eab582d8a8ee2af1a6baae7baf0696c7005de2e Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 15:16:44 -0400 Subject: fix: harden triggers, economy, casino, world data, and admin/net paths --- internal/admin/api_files.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/admin/api_files.go') diff --git a/internal/admin/api_files.go b/internal/admin/api_files.go index 96b5e81..2aa0e5f 100644 --- a/internal/admin/api_files.go +++ b/internal/admin/api_files.go @@ -108,6 +108,22 @@ func (s *AdminServer) handleFileRename(w http.ResponseWriter, r *http.Request) { return } + // A raw rename changes the ID-bearing filename. Rebuild the room index + // and drop the old room's cached state (mirroring the DELETE path), and + // refresh item/mob/drop caches, or the old ID resolves to a deleted file + // and the new one resolves to nothing until a restart. + s.evictDeletedRoomFile(relPath) + s.invalidateEntityCacheForPath(newAbs) + // Hazards and courses have their own runtime caches that a raw rename + // must refresh (the undo path does the same). Techs and triggers keep the + // documented in-game `reload` requirement. + if pathUnderDir(s.dataDir, "hazards", newAbs) { + s.world.ClearHazardCache() + } + if pathUnderDir(s.dataDir, "courses", newAbs) { + s.reloadCoursesIfWired() + } + newRelPath := filepath.Join(filepath.Dir(relPath), newName) if filepath.Dir(relPath) == "." { newRelPath = newName -- cgit v1.2.3