aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_files.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 15:16:44 -0400
committerhistoria <[not public]>2026-09-18 15:16:44 -0400
commit7eab582d8a8ee2af1a6baae7baf0696c7005de2e (patch)
tree902bbc8c6e39c9f62f779ca23267714ec420b9f5 /internal/admin/api_files.go
parent153acb7f644d755c45533b7c5311e3ffa47e8973 (diff)
downloadthehouseoficarus-7eab582d8a8ee2af1a6baae7baf0696c7005de2e.tar.gz
fix: harden triggers, economy, casino, world data, and admin/net paths
Diffstat (limited to 'internal/admin/api_files.go')
-rw-r--r--internal/admin/api_files.go16
1 files changed, 16 insertions, 0 deletions
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