diff options
| author | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
| commit | 153acb7f644d755c45533b7c5311e3ffa47e8973 (patch) | |
| tree | 7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/admin/api_triggers.go | |
| parent | 87d08f0151e643951769e323995f1c5ed89ee200 (diff) | |
| download | thehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz | |
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/admin/api_triggers.go')
| -rw-r--r-- | internal/admin/api_triggers.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/admin/api_triggers.go b/internal/admin/api_triggers.go index 5b82465..08e2855 100644 --- a/internal/admin/api_triggers.go +++ b/internal/admin/api_triggers.go @@ -147,12 +147,21 @@ func (s *AdminServer) handleTriggerByID(w http.ResponseWriter, r *http.Request) os.Remove(oldPath) } - s.undoStack.Push(ChangeDesc{ + desc := ChangeDesc{ Description: "Update trigger " + id, FilePath: newPath, OldContent: oldContent, NewContent: triggerData, - }) + } + if findErr == nil && newSubdir != oldDir { + // A kind change moves the file between subdirectories. Record the + // old path as the before-image location so undo restores the old + // content there (and removes the new file) instead of writing the + // old content into the new directory and orphaning the old path. + desc.FilePath = oldPath + desc.NewFilePath = newPath + } + s.undoStack.Push(desc) s.rebuildTriggerIndex() writeJSON(w, map[string]any{"ok": true, "id": id, "kind": newKind}) |
