1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00

Implement S3 missing object error handling

This commit is contained in:
Lukas SP 2020-09-02 19:13:49 +02:00
parent 71e6baad95
commit 6b4563c7c9
2 changed files with 5 additions and 4 deletions

3
.gitignore vendored
View File

@ -115,4 +115,5 @@ modules.xml
# End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,go # End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,go
web/*.gz web/*.gz
data/ data/
.env

View File

@ -63,11 +63,11 @@ func (driver *S3Driver) Get(id string) (*pastes.Paste, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
if object == nil {
return nil, nil
}
data, err := ioutil.ReadAll(object) data, err := ioutil.ReadAll(object)
if err != nil { if err != nil {
if minio.ToErrorResponse(err).Code == "NoSuchKey" {
return nil, nil
}
return nil, err return nil, err
} }