forked from TrueCloudLab/distribution
Merge pull request #1787 from RichardScothern/nr
Re-add support for non-resumable digests
This commit is contained in:
commit
f4296d55fc
3 changed files with 5 additions and 5 deletions
|
@ -77,7 +77,7 @@ func blobUploadDispatcher(ctx *Context, r *http.Request) http.Handler {
|
||||||
|
|
||||||
if size := upload.Size(); size != buh.State.Offset {
|
if size := upload.Size(); size != buh.State.Offset {
|
||||||
defer upload.Close()
|
defer upload.Close()
|
||||||
ctxu.GetLogger(ctx).Infof("upload resumed at wrong offest: %d != %d", size, buh.State.Offset)
|
ctxu.GetLogger(ctx).Errorf("upload resumed at wrong offest: %d != %d", size, buh.State.Offset)
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
buh.Errors = append(buh.Errors, v2.ErrorCodeBlobUploadInvalid.WithDetail(err))
|
buh.Errors = append(buh.Errors, v2.ErrorCodeBlobUploadInvalid.WithDetail(err))
|
||||||
upload.Cancel(buh)
|
upload.Cancel(buh)
|
||||||
|
|
|
@ -86,10 +86,10 @@ func (bw *blobWriter) Commit(ctx context.Context, desc distribution.Descriptor)
|
||||||
return canonical, nil
|
return canonical, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rollback the blob upload process, releasing any resources associated with
|
// Cancel the blob upload process, releasing any resources associated with
|
||||||
// the writer and canceling the operation.
|
// the writer and canceling the operation.
|
||||||
func (bw *blobWriter) Cancel(ctx context.Context) error {
|
func (bw *blobWriter) Cancel(ctx context.Context) error {
|
||||||
context.GetLogger(ctx).Debug("(*blobWriter).Rollback")
|
context.GetLogger(ctx).Debug("(*blobWriter).Cancel")
|
||||||
if err := bw.fileWriter.Cancel(); err != nil {
|
if err := bw.fileWriter.Cancel(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ func (bw *blobWriter) Close() error {
|
||||||
return errors.New("blobwriter close after commit")
|
return errors.New("blobwriter close after commit")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := bw.storeHashState(bw.blobStore.ctx); err != nil {
|
if err := bw.storeHashState(bw.blobStore.ctx); err != nil && err != errResumableDigestNotAvailable {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// resumeHashAt is a noop when resumable digest support is disabled.
|
// resumeHashAt is a noop when resumable digest support is disabled.
|
||||||
func (bw *blobWriter) resumeDigestAt(ctx context.Context, offset int64) error {
|
func (bw *blobWriter) resumeDigest(ctx context.Context) error {
|
||||||
return errResumableDigestNotAvailable
|
return errResumableDigestNotAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue