feat(resource-detail): add file size and mime type to document links#1691
Merged
rudivanhierden merged 3 commits intoJul 14, 2026
Merged
Conversation
Add file size to document download labels end-to-end, e.g. 'Title (PDF, 4,3 MB)', with Dutch number notation. Existing documents without stored size keep showing 'Title (PDF)' as a fallback. The size flows through the full chain: the image-server upload endpoints now return size and mimeType, the admin document-uploader forwards them, the resource-form zod schema accepts them (it previously stripped unknown keys on submit), and the resource-detail widget renders them via formatDocumentLabel. Covered by component tests for the kB/MB formatting and the no-size fallback. Closes openstad#1669 (Part 2)
SerdarAydemir
requested review from
ferhany and
rudivanhierden
and removed request for
a team
June 26, 2026 10:24
Contributor
Author
|
Heads-up: the Docker build check is failing on denied: installation not allowed to Write organization package when pushing to ghcr.io. This looks like a registry-write permission issue for PRs from forks, not something in the diff — the Prettier and other checks pass. Let me know if there's anything I should change on my side. |
rudivanhierden
approved these changes
Jul 14, 2026
Openstad Headless
|
||||||||||||||||||||||||||||
| Project |
Openstad Headless
|
| Branch Review |
main
|
| Run status |
|
| Run duration | 33m 19s |
| Commit |
|
| Committer | Serdar Aydemir |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
104
|
| View all changes introduced in this branch ↗︎ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Document download links now show the file size next to the type, e.g.
Title (PDF, 4,3 MB), with Dutch number notation. Builds on #1674 (Part 1).After
The bottom document was uploaded after this change and shows the size;
the documents above it predate the change and gracefully fall back to
(PDF)— existing documents keep working unchanged.Why
Relates to #1669 (Part 2). Part 1 added accessible humanized labels and the
file type. This part adds the file size, which WCAG 2.1 SC 2.4.4 calls for so
users know what they're downloading before they open it.
How — the size flows end-to-end
Tracing the upload chain, the size was being dropped at several points; this
PR fixes each:
/document,/documents): the upload response nowincludes
size(bytes) andmimeType, which multer already provides.size/mimeTypefrom the uploadresponse to the form (previously only
url/name).documentsnow acceptssize/mimeType— zod strips unknown keys on submit, so without this thesize never reached the API.
formatDocumentLabeltakes the size andrenders
(PDF, 4,3 MB), with kB/MB formatting and a no-size fallback.The
documentsfield on the resource is a schemaless JSON column, so nomigration is needed.
Testing
fallback) — 11 cases.
confirmed
size/mimeTypeare stored and rendered (see screenshot).Notes
(PDF)— this is theintended graceful fallback per Accessible document download links: display name, file type and file size #1669, not a regression. A backfill of
existing documents could be a future improvement.