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 }