feat: Media captures its upload filename as a required display label #193

Merged
rosa merged 1 commit from media/upload-filename-label into main 2026-08-12 17:59:05 +00:00
Owner

Every upload now carries the filename its file part was submitted under, parsed into a MediaFilename value type (basename only, trimmed, capped at 255 chars on a char boundary) and stored as an opaque display label for the Library and picker to render.

Deviating from the ticket's optional-label design by agreement: the filename is required. A file part with no usable filename is rejected with a 400 at both upload adapters — the post editor's multipart extractor and the Micropub media endpoint (invalid_request) — so a nameless Media cannot exist and nothing downstream handles the absent case. The web extractor hands handlers an already-parsed PhotoUpload, and PhotoAction::Replace carries it, so the handlers can't get it wrong.

  • Migration adds a NOT NULL filename column; pre-existing dev rows are backfilled with their hex id so reads stay valid.
  • Conformance tests cover the round-trip and survival across the Ready and Failed transitions against both the SQLite and in-memory adapters.
  • End-to-end tests assert the 400 rejection at both adapters.
  • CONTEXT.md glossary updated to the required-filename phrasing.

Closes #189

Every upload now carries the filename its file part was submitted under, parsed into a `MediaFilename` value type (basename only, trimmed, capped at 255 chars on a char boundary) and stored as an opaque display label for the Library and picker to render. Deviating from the ticket's optional-label design by agreement: the filename is required. A file part with no usable filename is rejected with a 400 at both upload adapters — the post editor's multipart extractor and the Micropub media endpoint (`invalid_request`) — so a nameless Media cannot exist and nothing downstream handles the absent case. The web extractor hands handlers an already-parsed `PhotoUpload`, and `PhotoAction::Replace` carries it, so the handlers can't get it wrong. - Migration adds a `NOT NULL` `filename` column; pre-existing dev rows are backfilled with their hex id so reads stay valid. - Conformance tests cover the round-trip and survival across the Ready and Failed transitions against both the SQLite and in-memory adapters. - End-to-end tests assert the 400 rejection at both adapters. - CONTEXT.md glossary updated to the required-filename phrasing. Closes #189
feat: Media captures its upload filename as a required display label
Some checks failed
ci/woodpecker/push/clippy Pipeline was canceled
ci/woodpecker/push/test Pipeline was canceled
443b89b1f4
Every upload now carries the filename its file part was submitted under,
parsed into a MediaFilename value type (basename only, trimmed, capped at
255 chars) and shown to the owner as an opaque label in the Library and
picker. Deviating from the ticket's optional-label design by agreement:
a file part with no usable filename is rejected with a 400 at both the
post editor and the Micropub media endpoint, so a nameless Media cannot
exist and nothing downstream handles the absent case.

Closes #189
rosa merged commit 3000131d27 into main 2026-08-12 17:59:05 +00:00
rosa deleted branch media/upload-filename-label 2026-08-12 17:59:05 +00:00
Sign in to join this conversation.
No description provided.