Skip to content

Commit

Permalink
Fixed errcheck issues in server/channels/api4/license_local.go (matte…
Browse files Browse the repository at this point in the history
…rmost#28558)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
  • Loading branch information
Aryakoste and hanzei authored Oct 24, 2024
1 parent cb03009 commit fbdf3cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion server/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ issues:
channels/api4/data_retention.go|\
channels/api4/file_test.go|\
channels/api4/job_test.go|\
channels/api4/license_local.go|\
channels/api4/post_test.go|\
channels/api4/preference_test.go|\
channels/api4/reaction_test.go|\
Expand Down
5 changes: 4 additions & 1 deletion server/channels/api4/license_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ func localAddLicense(c *Context, w http.ResponseWriter, r *http.Request) {
defer file.Close()

buf := bytes.NewBuffer(nil)
io.Copy(buf, file)
if _, err := io.Copy(buf, file); err != nil {
c.Err = model.NewAppError("addLicense", "api.license.add_license.copy.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
return
}

license, appErr := c.App.Srv().SaveLicense(buf.Bytes())
if appErr != nil {
Expand Down
2 changes: 1 addition & 1 deletion server/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@
},
{
"id": "api.license.add_license.copy.app_error",
"translation": "Failed to copy license."
"translation": "Failed to copy license file content to buffer"
},
{
"id": "api.license.add_license.expired.app_error",
Expand Down

0 comments on commit fbdf3cb

Please sign in to comment.