Skip to content

feat(endpoint-files): upload several files at once - #953

Merged
paulrobertlloyd merged 1 commit into
mainfrom
feat/endpoint-files-multiple-upload
Sep 26, 2026
Merged

paulrobertlloyd merged 1 commit into
mainfrom
feat/endpoint-files-multiple-upload

Conversation

@rmdes

@rmdes rmdes commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #952.

  • views/file-form.njk: the file input gets multiple. No script, no new component.
  • lib/controllers/form.js: request.files.file is normalised to an array and each file is posted to the media endpoint in turn (sequential on purpose: a Git-backed store may reject concurrent writes, GitHub upload conflict when uploading multiple images #792). One file keeps today's message from the media endpoint; several report files.upload.success (“%s files uploaded”); a mix reports files.upload.partial (“%s of %s files uploaded”); when nothing was uploaded the form re-renders with the last error, as it does now for one file.
  • locales/en.json: the two new strings, English only.
  • Mock agent: upload intercepts persist so a test can upload twice; a partial-post-upload.example origin answers 201 then 400.
  • Tests: the upload page has a multiple input; two files redirect with “2 files uploaded”; one of two failing redirects with “1 of 2 files uploaded”; two files against the 401 endpoint render the error. Three of these fail on main.

Verified locally: node --test packages/endpoint-files/test/**/*.js 18/18, eslint and prettier clean.

@rmdes rmdes added the plugin-endpoint Endpoint plug-in label Sep 6, 2026
@rmdes
rmdes force-pushed the feat/endpoint-files-multiple-upload branch from 7c052e8 to 7bb0cb5 Compare September 13, 2026 11:20
Accept a repeated file field, upload each file in turn, and report how
many were uploaded. The error page is shown only when none were.

Fixes #952
@paulrobertlloyd
paulrobertlloyd force-pushed the feat/endpoint-files-multiple-upload branch from 7bb0cb5 to e3dedba Compare September 26, 2026 11:03
@paulrobertlloyd
paulrobertlloyd merged commit 2c95a08 into main Sep 26, 2026
1 check passed
@paulrobertlloyd
paulrobertlloyd deleted the feat/endpoint-files-multiple-upload branch September 26, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin-endpoint Endpoint plug-in

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files endpoint uploads one file per form submission

2 participants