refactor(media): upload pieces are PUT, not PATCH

A piece at an offset is idempotent, which is what PUT means. Java's
HttpURLConnection, which the Kotlin port uses, refuses PATCH outright. nginx
also retries PUT on the next upstream by default but never PATCH, so the docs
now only ask for non_idempotent on the start/status POST. The protocol is
unreleased, so nothing else depends on the old method.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-19 00:09:09 +02:00
parent 441f26f814
commit f42a9bbe5e
6 changed files with 14 additions and 13 deletions

View File

@@ -67,7 +67,7 @@ New package **`@shade/media`** — see `docs/media.md`.
`@shade/storage-postgres`. A live pin can no longer change key, even between
instances (`LivePinTakenError`).
- **Uploads in pieces, resumable.** A sealed file over 16 MiB goes up as
`POST /v1/media/:id/upload` + 16 MiB `PATCH` pieces (each signed over its
`POST /v1/media/:id/upload` + 16 MiB `PUT` pieces (each signed over its
offset), up to 4 in flight and landing in any order. A dropped connection,
a relay restart or the next piece landing on another instance costs only the
pieces in flight: the client asks how far the upload got and sends the rest.