Skip to content

Metadata content.Store calls Digest before Commit #3394

@hinshun

Description

@hinshun

Description
Metadata content.Store calls (content.Writer).Digest before (content.Writer).Commit which may return empty digest or panics until committed.

actual = nw.w.Digest()
if err := nw.w.Commit(ctx, size, expected); err != nil && !errdefs.IsAlreadyExists(err) {
return "", err
}
}
bkt, err := createBlobBucket(tx, nw.namespace, actual)

See content.Writer's interface:

// Writer handles the write of content into a content store
type Writer interface {
// Close closes the writer, if the writer has not been
// committed this allows resuming or aborting.
// Calling Close on a closed writer will not error.
io.WriteCloser
// Digest may return empty digest or panics until committed.
Digest() digest.Digest

Only affects proxy/plugin content stores that may not have a digest available until committed, leading to metadata content.Store attempting to create a bucket with empty string and returning ErrBucketNameRequired:

failed commit on ref "<ref>": commit failed: bucket name required: unknown

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions