Skip to content

Commit

Permalink
fix(s3): use HeadObject for checking if blob exists (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergemalm authored Nov 23, 2024
1 parent 6f73b2b commit 55f61a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions longtailstorelib/s3Store.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ func (blobObject *s3BlobObject) LockWriteVersion() (bool, error) {

func (blobObject *s3BlobObject) Exists() (bool, error) {
const fname = "s3BlobObject.Exists()"
input := &s3.GetObjectAclInput{
input := &s3.HeadObjectInput{
Bucket: aws.String(blobObject.client.store.bucketName),
Key: aws.String(blobObject.path),
}
_, err := blobObject.client.client.GetObjectAcl(blobObject.client.ctx, input)
_, err := blobObject.client.client.HeadObject(blobObject.client.ctx, input)
if err != nil {
var nsk *types.NoSuchKey
if errors.As(err, &nsk) {
var notFoundErr *types.NotFound
if errors.As(err, &notFoundErr) {
return false, nil
}
return false, errors.Wrap(err, fname)
Expand Down

0 comments on commit 55f61a8

Please sign in to comment.