Compare commits

...

2 Commits

Author SHA1 Message Date
Dong Chen
241ac6e003 check with HEAD before upload 2026-02-27 14:29:17 -08:00
Dong Chen
17dc6918cf handle edge case when a blob has been uploaded earlier 2026-02-27 14:12:15 -08:00

View File

@@ -150,6 +150,14 @@ func (u *uploader) uploadOnce(ctx context.Context, blob Blob) (int64, error) {
u.logger.Debug("uploading blob", "digest", blob.Digest, "size", blob.Size)
}
// Check if blob already exists (may have been uploaded by another
// concurrent process since the initial HEAD check)
if exists, err := u.exists(ctx, blob); err != nil {
return 0, err
} else if exists {
return 0, nil
}
// Init upload
uploadURL, err := u.initUpload(ctx, blob)
if err != nil {