diff --git a/copy/blob.go b/copy/blob.go index f45b97f56c..293ed4f1fa 100644 --- a/copy/blob.go +++ b/copy/blob.go @@ -129,7 +129,9 @@ func (ic *imageCopier) copyBlobFromStream(ctx context.Context, srcReader io.Read } if digestingReader.validationFailed { // Coverage: This should never happen. - return types.BlobInfo{}, fmt.Errorf("Internal error writing blob %s, digest verification failed but was ignored", srcInfo.Digest) + uploadedInfo.Digest = digestingReader.digester.Digest() + logrus.Warningf("Digest verification failed for blob %s, using computed %s", srcInfo.Digest, uploadedInfo.Digest) + return uploadedInfo, nil } if stream.info.Digest != "" && uploadedInfo.Digest != stream.info.Digest { return types.BlobInfo{}, fmt.Errorf("Internal error writing blob %s, blob with digest %s saved with digest %s", srcInfo.Digest, stream.info.Digest, uploadedInfo.Digest) diff --git a/copy/digesting_reader.go b/copy/digesting_reader.go index 901d10826f..d5ce4dfcbf 100644 --- a/copy/digesting_reader.go +++ b/copy/digesting_reader.go @@ -54,9 +54,9 @@ func (d *digestingReader) Read(p []byte) (int, error) { actualDigest := d.digester.Digest() if actualDigest != d.expectedDigest { d.validationFailed = true - return 0, fmt.Errorf("Digest did not match, expected %s, got %s", d.expectedDigest, actualDigest) + } else { + d.validationSucceeded = true } - d.validationSucceeded = true } return n, err }