mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/backup/s3remote: fix error checking for alternative S3 providers (#3191)
This commit is contained in:
parent
f7af86d48e
commit
db791a254b
1 changed files with 1 additions and 3 deletions
|
@ -3,7 +3,6 @@ package s3remote
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -12,7 +11,6 @@ import (
|
||||||
"github.com/aws/aws-sdk-go-v2/config"
|
"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/feature/s3/manager"
|
||||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
"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/common"
|
||||||
"github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/fscommon"
|
"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)
|
o, err := fs.s3.GetObject(context.Background(), input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, &types.NoSuchKey{}) {
|
if strings.Contains(err.Error(), "NoSuchKey") {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
return false, fmt.Errorf("cannot open %q at %s (remote path %q): %w", filePath, fs, path, err)
|
return false, fmt.Errorf("cannot open %q at %s (remote path %q): %w", filePath, fs, path, err)
|
||||||
|
|
Loading…
Reference in a new issue