From 45860309b1991b95ad1a366d08775e2dc143d198 Mon Sep 17 00:00:00 2001 From: Arya Khochare <91268931+Aryakoste@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:00:30 +0530 Subject: [PATCH] Fixed errcheck issues in server/channels/app/plugin_install.go (#29062) Co-authored-by: Ben Schumacher --- server/.golangci.yml | 1 - server/channels/app/plugin_install.go | 4 +++- server/i18n/en.json | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index 391133918e..02c58e1293 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -115,7 +115,6 @@ issues: channels/app/platform/web_conn.go|\ channels/app/platform/web_hub.go|\ channels/app/platform/web_hub_test.go|\ - channels/app/plugin_install.go|\ channels/app/plugin_signature_test.go|\ channels/app/plugin_test.go|\ channels/app/post_helpers_test.go|\ diff --git a/server/channels/app/plugin_install.go b/server/channels/app/plugin_install.go index 30f4fe17b9..9b086c6dea 100644 --- a/server/channels/app/plugin_install.go +++ b/server/channels/app/plugin_install.go @@ -389,7 +389,9 @@ func (ch *Channels) installPluginLocally(bundle io.ReadSeeker, installationStrat // extractPlugin unpacks the given plugin bundle into the specified directory. func extractPlugin(bundle io.ReadSeeker, extractDir string) (*model.Manifest, string, *model.AppError) { - bundle.Seek(0, 0) + if _, err := bundle.Seek(0, 0); err != nil { + return nil, "", model.NewAppError("extractPlugin", "app.plugin.seek.app_error", nil, "", http.StatusInternalServerError).Wrap(err) + } if err := extractTarGz(bundle, extractDir); err != nil { return nil, "", model.NewAppError("extractPlugin", "app.plugin.extract.app_error", nil, "", http.StatusBadRequest).Wrap(err) } diff --git a/server/i18n/en.json b/server/i18n/en.json index 6bc4c6d588..6c4f4de8c2 100644 --- a/server/i18n/en.json +++ b/server/i18n/en.json @@ -6154,6 +6154,10 @@ "id": "app.plugin.restart.app_error", "translation": "Unable to restart plugin on upgrade." }, + { + "id": "app.plugin.seek.app_error", + "translation": "Unable to reset the read position to the start of the plugin bundle." + }, { "id": "app.plugin.signature_decode.app_error", "translation": "Unable to decode base64 signature."