Repro on v3.18.0:
- Edit a draft.
- Upload banner A → server stores
/uploads/<slug>/<ts>-A.png; form points there.
- Upload banner B (swap) → server stores
/uploads/<slug>/<ts>-B.png; form points to B. File A remains on disk.
- Click Remove → form clears
banner + banner_alt. File B remains on disk.
- Re-upload C → form points to C. Files A and B both remain.
- Save draft → only the current file (C) is referenced by frontmatter; A and B are orphans.
Result on the reference deploy: a test draft session left three PNGs on disk; only manual rm -r /opt/<deploy>/uploads/<slug>/ cleaned them up post draft-delete.
Reasonable fix: on swap-replace, unlink the previous file. On remove, unlink the current file. On draft delete (when added — /admin/drafts currently has no Delete affordance), rm -r the slug's uploads dir. Per-slug GC sweep on startup is a bigger hammer that also works.
Repro on v3.18.0:
/uploads/<slug>/<ts>-A.png; form points there./uploads/<slug>/<ts>-B.png; form points to B. File A remains on disk.banner+banner_alt. File B remains on disk.Result on the reference deploy: a test draft session left three PNGs on disk; only manual
rm -r /opt/<deploy>/uploads/<slug>/cleaned them up post draft-delete.Reasonable fix: on swap-replace, unlink the previous file. On remove, unlink the current file. On draft delete (when added —
/admin/draftscurrently has no Delete affordance),rm -rthe slug's uploads dir. Per-slug GC sweep on startup is a bigger hammer that also works.