Fixed errcheck issues in server/channels/app/integration_action.go (#29040)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
Arya Khochare
2025-04-14 17:26:05 +05:30
коммит произвёл GitHub
родитель 7789223494
Коммит 0f860f0512
3 изменённых файлов: 22 добавлений и 2 удалений

Просмотреть файл

@@ -95,7 +95,6 @@ issues:
channels/app/file_test.go|\
channels/app/helper_test.go|\
channels/app/import_functions.go|\
channels/app/integration_action.go|\
channels/app/permissions_test.go|\
channels/app/platform/helper_test.go|\
channels/app/platform/license.go|\

Просмотреть файл

@@ -514,8 +514,21 @@ func (a *App) SubmitInteractiveDialog(c request.CTX, request model.SubmitDialogR
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, model.NewAppError("SubmitInteractiveDialog", "app.submit_interactive_dialog.read_body_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
var response model.SubmitDialogResponse
json.NewDecoder(resp.Body).Decode(&response) // Don't fail, an empty response is acceptable
if len(body) == 0 {
// Don't fail, an empty response is acceptable
return &response, nil
}
err = json.Unmarshal(body, &response)
if err != nil {
return nil, model.NewAppError("SubmitInteractiveDialog", "app.submit_interactive_dialog.decode_json_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
return &response, nil
}

Просмотреть файл

@@ -6876,10 +6876,18 @@
"id": "app.status.get.missing.app_error",
"translation": "No entry for that status exists."
},
{
"id": "app.submit_interactive_dialog.decode_json_error",
"translation": "Encountered an error decoding JSON response from interactive dialog submission."
},
{
"id": "app.submit_interactive_dialog.json_error",
"translation": "Encountered an error encoding JSON for the interactive dialog."
},
{
"id": "app.submit_interactive_dialog.read_body_error",
"translation": "Encountered an error reading response body from interactive dialog submission."
},
{
"id": "app.system.complete_onboarding_request.app_error",
"translation": "Failed to decode the complete onboarding request."