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:
parent
71e6baad95
commit
6b4563c7c9
3
.gitignore
vendored
3
.gitignore
vendored
@ -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
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user