From a5ccf742c1ab0af3f350a42a5a4e511780c238b3 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Thu, 16 Nov 2023 12:18:03 -0800 Subject: [PATCH] fix cross repo mounts --- server/upload.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/upload.go b/server/upload.go index 8b483618..306b6e63 100644 --- a/server/upload.go +++ b/server/upload.go @@ -77,6 +77,14 @@ func (b *blobUpload) Prepare(ctx context.Context, requestURL *url.URL, opts *Reg b.Total = fi.Size() + // http.StatusCreated indicates a blob has been mounted + // ref: https://distribution.github.io/distribution/spec/api/#cross-repository-blob-mount + if resp.StatusCode == http.StatusCreated { + b.Completed.Store(b.Total) + b.done = true + return nil + } + var size = b.Total / numUploadParts switch { case size < minUploadPartSize: