Skip to content

Commit

Permalink
s3: remove fallback for file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Jan 6, 2024
1 parent 04b3daa commit 4623edb
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions s3/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import (
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
awsauth "github.com/smira/go-aws-auth"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)

const errCodeNotFound = "NotFound"
Expand Down Expand Up @@ -497,25 +494,11 @@ func (storage *PublishedStorage) FileExists(path string) (bool, error) {
_, err := storage.s3.HeadObject(context.TODO(), params)
if err != nil {
var notFoundErr *types.NotFound
log.Info().Msg("s3 file does not exist")
log.Info().Msgf("err: %s", err)

if errors.As(err, &notFoundErr) {
log.Info().Msgf("not found: %s", notFoundErr)
return false, nil
}

// falback in case the above condidition fails
var opErr *smithy.OperationError
if errors.As(err, &opErr) {
var ae smithy.APIError
if errors.As(err, &ae) {
if (ae.ErrorCode() == "NotFound") {
return false, nil
}
}
}

return false, err
}

Expand Down

0 comments on commit 4623edb

Please sign in to comment.