From 512cd52fe2d5f9b6ec4955cf860d157db3f66175 Mon Sep 17 00:00:00 2001 From: Ashwanth Goli Date: Thu, 10 Oct 2024 12:40:30 +0530 Subject: [PATCH] return err if Size is not set Signed-off-by: Ashwanth Goli --- objstore.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/objstore.go b/objstore.go index 116538ca..5bce3ef6 100644 --- a/objstore.go +++ b/objstore.go @@ -837,5 +837,9 @@ type ObjectSizerReadCloser struct { // ObjectSize implement ObjectSizer. func (o ObjectSizerReadCloser) ObjectSize() (int64, error) { + if o.Size == nil { + return 0, errors.New("unknown size") + } + return o.Size() }