From 97239e05cef6716304a40bbbb19cf894018dde8d Mon Sep 17 00:00:00 2001 From: Zakhar Bessarab Date: Thu, 6 Oct 2022 13:36:40 +0300 Subject: [PATCH] lib/backup/s3remote: fix error checking for alternative S3 providers (#3191) --- lib/backup/s3remote/s3.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/backup/s3remote/s3.go b/lib/backup/s3remote/s3.go index dcc51d5e8..f6dafe583 100644 --- a/lib/backup/s3remote/s3.go +++ b/lib/backup/s3remote/s3.go @@ -3,7 +3,6 @@ package s3remote import ( "bytes" "context" - "errors" "fmt" "io" "strings" @@ -12,7 +11,6 @@ import ( "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/feature/s3/manager" "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/common" "github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/fscommon" @@ -307,7 +305,7 @@ func (fs *FS) HasFile(filePath string) (bool, error) { } o, err := fs.s3.GetObject(context.Background(), input) if err != nil { - if errors.Is(err, &types.NoSuchKey{}) { + if strings.Contains(err.Error(), "NoSuchKey") { return false, nil } return false, fmt.Errorf("cannot open %q at %s (remote path %q): %w", filePath, fs, path, err)