mirror of https://github.com/perkeep/perkeep.git
pkg/blobserver/diskpacked: fail earlier in StreamBlobs
As Miki Habryn suggested at https://groups.google.com/forum/#!topic/camlistore/WmUyUWMfZx0%5B1-25%5D Change-Id: Ib910e5bcfa7eb33360f7b5e1085bd9bb1f0e9e6a
This commit is contained in:
parent
815575e493
commit
4754ab6c4b
|
@ -611,6 +611,11 @@ func (s *storage) StreamBlobs(ctx context.Context, dest chan<- blobserver.BlobAn
|
|||
continue
|
||||
}
|
||||
|
||||
ref, ok := blob.ParseBytes(digest)
|
||||
if !ok {
|
||||
return fmt.Errorf("diskpacked: Invalid blobref %q", digest)
|
||||
}
|
||||
|
||||
// Finally, read and send the blob.
|
||||
|
||||
// TODO: remove this allocation per blob. We can make one instead
|
||||
|
@ -624,10 +629,6 @@ func (s *storage) StreamBlobs(ctx context.Context, dest chan<- blobserver.BlobAn
|
|||
return err
|
||||
}
|
||||
offset += int64(size)
|
||||
ref, ok := blob.ParseBytes(digest)
|
||||
if !ok {
|
||||
return fmt.Errorf("diskpacked: Invalid blobref %q", digest)
|
||||
}
|
||||
newReader := func() readerutil.ReadSeekCloser {
|
||||
return newReadSeekNopCloser(bytes.NewReader(data))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue