From ac30b9d4686b49a9bb107dbfb81fcf6d5da2e225 Mon Sep 17 00:00:00 2001 From: Nils <57401795+NilsArnlund@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:50:14 +0200 Subject: [PATCH] Fixed errcheck in server/channel/api4/job.go (#28420) --- server/.golangci.yml | 1 - server/channels/api4/job.go | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index 6041a441b2..bc13bc06d7 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -86,7 +86,6 @@ issues: channels/api4/integration_action_test.go|\ channels/api4/ip_filtering.go|\ channels/api4/ip_filtering_test.go|\ - channels/api4/job.go|\ channels/api4/job_test.go|\ channels/api4/ldap.go|\ channels/api4/license.go|\ diff --git a/server/channels/api4/job.go b/server/channels/api4/job.go index e577c7943c..a794b1874f 100644 --- a/server/channels/api4/job.go +++ b/server/channels/api4/job.go @@ -210,7 +210,9 @@ func getJobs(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = model.NewAppError("getJobs", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err) return } - w.Write(js) + if _, err := w.Write(js); err != nil { + c.Logger.Warn("Error while writing response", mlog.Err(err)) + } } func getJobsByType(c *Context, w http.ResponseWriter, r *http.Request) { @@ -241,7 +243,9 @@ func getJobsByType(c *Context, w http.ResponseWriter, r *http.Request) { return } - w.Write(js) + if _, err := w.Write(js); err != nil { + c.Logger.Warn("Error while writing response", mlog.Err(err)) + } } func cancelJob(c *Context, w http.ResponseWriter, r *http.Request) {