diff options
| author | historia <[not public]> | 2026-09-18 20:03:13 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 20:03:13 -0400 |
| commit | 79764732406d6484f67d3dec045483dcb5d08c28 (patch) | |
| tree | 7a64e8581a540b97ed554f5723e2d587424ab1c6 /internal/admin/api_techs.go | |
| parent | f1e461ab6aec6b9bf056bbe2daa88a251e0f21da (diff) | |
| download | thehouseoficarus-79764732406d6484f67d3dec045483dcb5d08c28.tar.gz | |
feat: better card ascii art
Diffstat (limited to 'internal/admin/api_techs.go')
| -rw-r--r-- | internal/admin/api_techs.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/admin/api_techs.go b/internal/admin/api_techs.go index 9e742e1..d2c5f65 100644 --- a/internal/admin/api_techs.go +++ b/internal/admin/api_techs.go @@ -111,9 +111,16 @@ func (s *AdminServer) handleTechByID(w http.ResponseWriter, r *http.Request) { var oldContent []byte if !isCreate { - if existing, err := snapshotFile(path); err == nil { - oldContent = existing + existing, existed, err := snapshotBefore(path) + if err != nil { + failJSON(w, "read existing file: "+err.Error()) + return } + if !existed { + failJSON(w, "not found: "+id) + return + } + oldContent = existing } newContent, err := writeMapAsYAML(path, body) |
