mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 21:17:58 +08:00
9ba59559d2
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>
54 KiB
54 KiB