Andrei Aaron 9ba59559d2 fix(api): return 416 for bad upload range on PUT; fix GET upload Range at size zero (#3983)
Align closing blob upload (PUT) with the OCI Distribution Spec: invalid /
out-of-order upload ranges (ErrBadUploadRange) return 416 Requested Range Not
Satisfiable instead of 400, for both the final-chunk PutBlobChunk path and
FinishBlobUpload.

GetBlobUpload (GET upload status): fix the Range response when zero bytes have
been received—send Range: 0-0 instead of Range: 0--1, consistent with a new
session and the spec’s Location + Range upload status shape. Only map
ErrBadBlobDigest to 400 here; do not handle ErrBadUploadRange on GET (that
request carries no range; ImageStore.GetBlobUpload does not return it).

Document PUT upload failures 400 and 416 in swagger; regenerate swagger
artifacts. Update route tests (expect 416 on UpdateBlobUpload for
ErrBadUploadRange), drop the mock-only GetBlobUpload+ErrBadUploadRange case,
and assert Range: 0-0 in TestPullRange after GET on a new upload location.

Fix potential panic when parsing Content-Range (index out of range)
when accessing `tokens[0]`.

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
2026-04-20 08:24:36 +03:00
2024-01-17 17:22:33 +02:00
2026-04-17 09:11:32 +03:00
2026-04-17 09:11:32 +03:00
2025-05-25 11:57:49 +03:00
2026-04-17 09:11:32 +03:00
2024-03-14 09:43:42 -07:00
2019-06-21 15:29:19 -07:00

zot

build test nightly jobs codecov conformance CodeQL CII Best Practices OpenSSF Scorecard Go Reference FOSSA Status

zot: a production-ready vendor-neutral OCI image registry - images stored in OCI image format, distribution specification on-the-wire, that's it!

Documentation for zot is located at: https://zotregistry.dev

Code of conduct details are here.

License

FOSSA Status

Languages
Go 93%
Shell 6.4%
Makefile 0.4%