Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions providers/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"strings"
"testing"

"github.com/efficientgo/core/logerrcapture"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/minio/minio-go/v7"
Expand Down Expand Up @@ -438,21 +437,12 @@ func (b *Bucket) getRange(ctx context.Context, name string, off, length int64) (
return nil, err
}
}
r, err := b.client.GetObject(ctx, b.name, name, *opts)
if err != nil {
return nil, err
}

// NotFoundObject error is revealed only after first Read. This does the initial GetRequest. Prefetch this here
// for convenience.
if _, err := r.Read(nil); err != nil {
defer logerrcapture.Do(b.logger, r.Close, "s3 get range obj close")

// First GET Object request error.
// StatObject to see if the object exists and we have permissions to read it
if _, err := b.client.StatObject(ctx, b.name, name, *opts); err != nil {
return nil, err
}

return r, nil
return b.client.GetObject(ctx, b.name, name, *opts)
}

// Get returns a reader for the given object name.
Expand Down
Loading