Skip to content

Commit

Permalink
fix: s3 not found should not return an error
Browse files Browse the repository at this point in the history
  • Loading branch information
mstg committed Sep 11, 2021
1 parent 1e769f9 commit 7c15c41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/blob/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package s3
import (
"bytes"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
Expand Down Expand Up @@ -89,7 +90,10 @@ func (s *S3) Read(path string) ([]byte, error) {
Key: aws.String(path),
})
if err != nil {
return nil, err
s3err, ok := err.(awserr.Error)
if !ok || s3err.Code() != s3.ErrCodeNoSuchKey {
return nil, err
}
}

body, err := ioutil.ReadAll(obj.Body)
Expand Down

0 comments on commit 7c15c41

Please sign in to comment.