From 55f61a8d5e3559180b0d5fec8d3a48d6c0e7bab8 Mon Sep 17 00:00:00 2001 From: Mikael Bergemalm Date: Sat, 23 Nov 2024 10:55:37 +0100 Subject: [PATCH] fix(s3): use HeadObject for checking if blob exists (#259) --- longtailstorelib/s3Store.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/longtailstorelib/s3Store.go b/longtailstorelib/s3Store.go index b7aa52a0..22363855 100644 --- a/longtailstorelib/s3Store.go +++ b/longtailstorelib/s3Store.go @@ -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, ¬FoundErr) { return false, nil } return false, errors.Wrap(err, fname)