diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-08-01 16:55:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 16:55:18 +0200 |
commit | d81a61398d01d839e70e2345da787e7ef89c0832 (patch) | |
tree | a0702c7874ae31b487bb0b87dcce613edc1e53b9 /api4/brand.go | |
parent | 1f168263a2ff73ddee1193cccdeea533f6d501fe (diff) | |
download | chat-d81a61398d01d839e70e2345da787e7ef89c0832.tar.gz chat-d81a61398d01d839e70e2345da787e7ef89c0832.tar.bz2 chat-d81a61398d01d839e70e2345da787e7ef89c0832.zip |
Migrate all the api4 to handle errors in idiomatic way (#9143)
Diffstat (limited to 'api4/brand.go')
-rw-r--r-- | api4/brand.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/api4/brand.go b/api4/brand.go index 2e3081353..b6d353a29 100644 --- a/api4/brand.go +++ b/api4/brand.go @@ -19,13 +19,15 @@ func (api *API) InitBrand() { func getBrandImage(c *Context, w http.ResponseWriter, r *http.Request) { // No permission check required - if img, err := c.App.GetBrandImage(); err != nil { + img, err := c.App.GetBrandImage() + if err != nil { w.WriteHeader(http.StatusNotFound) w.Write(nil) - } else { - w.Header().Set("Content-Type", "image/png") - w.Write(img) + return } + + w.Header().Set("Content-Type", "image/png") + w.Write(img) } func uploadBrandImage(c *Context, w http.ResponseWriter, r *http.Request) { |