diff --git a/blob.go b/blob.go index eb5c34c..4c7a0e5 100644 --- a/blob.go +++ b/blob.go @@ -59,11 +59,16 @@ func (b *blobStore) Read(key string, opts ...store.BlobOption) (io.Reader, error } // look for the blob within the bucket - value = bucket.Get([]byte(key)) - if value == nil { + res := bucket.Get([]byte(key)) + if res == nil { return store.ErrNotFound } + // the res object is only valid for the duration of the blot transaction, see: + // https://github.com/golang/go/issues/33047 + value = make([]byte, len(res)) + copy(value, res) + return nil } if err := db.View(readValue); err != nil {