mirror of
https://github.com/Screenly/Anthias.git
synced 2026-06-10 09:08:09 -04:00
docs(server): attribute single-file limit to the endpoint, not htmx
The comments said htmx "would only ever send the first file", but htmx includes every selected file in the multipart body — the real single-file constraint is assets_upload reading request.FILES.get. Reword both comments. Comment-only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -223,13 +223,14 @@ function homeApp(): HomeAppData {
|
||||
},
|
||||
|
||||
// Multi-file upload (issue #3045). The server's assets_upload
|
||||
// endpoint takes exactly one file per POST, so a multi-select
|
||||
// batch is uploaded sequentially — one XHR per file — rather
|
||||
// than via htmx's single-form submit. Driving it from JS (instead
|
||||
// of hx-post on the <form>) is what makes "X of N" progress and
|
||||
// per-file failure handling possible; htmx would only ever see
|
||||
// the first file in the input. Mirrors the pre-#2818 React
|
||||
// behaviour added in #2778.
|
||||
// endpoint reads exactly one file per request
|
||||
// (request.FILES.get('file_upload')), so a single htmx form POST —
|
||||
// which would carry every selected file in the multipart body —
|
||||
// would still only create one asset. uploadFiles() instead uploads
|
||||
// the batch sequentially, one XHR (one file) per request. Driving
|
||||
// it from JS (instead of hx-post on the <form>) is also what makes
|
||||
// "X of N" progress and per-file failure handling possible. Mirrors
|
||||
// the pre-#2818 React behaviour added in #2778.
|
||||
async uploadFiles(input: HTMLInputElement) {
|
||||
const files = input.files ? Array.from(input.files) : []
|
||||
const form = input.form
|
||||
|
||||
@@ -66,12 +66,14 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% comment %} The file tab is NOT htmx-managed. assets_upload takes
|
||||
one file per POST, so a multi-select batch is uploaded
|
||||
sequentially by uploadFiles() in home.ts (one XHR per file) —
|
||||
htmx's single-form submit would only ever send the first file.
|
||||
The action / enctype attributes stay so uploadFiles() can read
|
||||
the endpoint URL off the form and the CSRF token off its input.
|
||||
{% comment %} The file tab is NOT htmx-managed. assets_upload reads
|
||||
one file per request (request.FILES.get('file_upload')), so a
|
||||
single htmx form POST — even though it would carry every
|
||||
selected file in the multipart body — would only ever get one
|
||||
asset created. uploadFiles() in home.ts instead uploads the
|
||||
batch sequentially, one XHR (one file) per request. The action
|
||||
/ enctype attributes stay so uploadFiles() can read the endpoint
|
||||
URL off the form and the CSRF token off its input.
|
||||
{% endcomment %}
|
||||
<form
|
||||
x-show="tab === 'file'"
|
||||
|
||||
Reference in New Issue
Block a user