From 679a4447b46ab448e75ec50c761da14ccf837d32 Mon Sep 17 00:00:00 2001 From: Claudio Costa Date: Thu, 3 Sep 2020 19:25:01 +0200 Subject: [PATCH] Fix error handling (#15392) --- services/filesstore/s3store.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/filesstore/s3store.go b/services/filesstore/s3store.go index 42f7308127..468047553b 100644 --- a/services/filesstore/s3store.go +++ b/services/filesstore/s3store.go @@ -6,6 +6,7 @@ package filesstore import ( "bytes" "context" + "errors" "io" "io/ioutil" "net/http" @@ -140,7 +141,8 @@ func (b *S3FileBackend) FileExists(path string) (bool, *model.AppError) { return true, nil } - if err.(s3.ErrorResponse).Code == "NoSuchKey" { + var s3Err s3.ErrorResponse + if errors.As(err, &s3Err); s3Err.Code == "NoSuchKey" { return false, nil }