Skip to content

Commit

Permalink
OCI source: return error if open blob failed
Browse files Browse the repository at this point in the history
Signed-off-by: Ye Yin <eyniy@qq.com>
  • Loading branch information
hustcat committed Nov 11, 2016
1 parent e9fed84 commit b671ec2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions oci/layout/oci_src.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *ociImageSource) GetTargetManifest(digest string) ([]byte, string, error
return m, manifest.GuessMIMEType(m), nil
}

// GetBlob returns a stream for the specified blob, and the blobs size (or -1 if unknown).
// GetBlob returns a stream for the specified blob, and the blob's size.
func (s *ociImageSource) GetBlob(digest string) (io.ReadCloser, int64, error) {
path, err := s.ref.blobPath(digest)
if err != nil {
Expand All @@ -79,11 +79,11 @@ func (s *ociImageSource) GetBlob(digest string) (io.ReadCloser, int64, error) {

r, err := os.Open(path)
if err != nil {
return nil, 0, nil
return nil, 0, err
}
fi, err := r.Stat()
if err != nil {
return nil, 0, nil
return nil, 0, err
}
return r, fi.Size(), nil
}
Expand Down
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ type Image interface {
// ConfigInfo returns a complete BlobInfo for the separate config object, or a BlobInfo{Digest:""} if there isn't a separate object.
// Note that the config object may not exist in the underlying storage in the return value of UpdatedImage! Use ConfigBlob() below.
ConfigInfo() BlobInfo
// ConfigBlob returns the blob described by ConfigInfo, iff ConfigInfo().Digest != ""; nil otherwise.
// ConfigBlob returns the blob described by ConfigInfo, if ConfigInfo().Digest != ""; nil otherwise.
// The result is cached; it is OK to call this however often you need.
ConfigBlob() ([]byte, error)
// LayerInfos returns a list of BlobInfos of layers referenced by this image, in order (the root layer first, and then successive layered layers).
Expand Down

0 comments on commit b671ec2

Please sign in to comment.