Fixed errcheck issues in server/channels/app/integration_action.go (#29040)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7789223494
Коммит
0f860f0512
@@ -95,7 +95,6 @@ issues:
|
|||||||
channels/app/file_test.go|\
|
channels/app/file_test.go|\
|
||||||
channels/app/helper_test.go|\
|
channels/app/helper_test.go|\
|
||||||
channels/app/import_functions.go|\
|
channels/app/import_functions.go|\
|
||||||
channels/app/integration_action.go|\
|
|
||||||
channels/app/permissions_test.go|\
|
channels/app/permissions_test.go|\
|
||||||
channels/app/platform/helper_test.go|\
|
channels/app/platform/helper_test.go|\
|
||||||
channels/app/platform/license.go|\
|
channels/app/platform/license.go|\
|
||||||
|
|||||||
@@ -514,8 +514,21 @@ func (a *App) SubmitInteractiveDialog(c request.CTX, request model.SubmitDialogR
|
|||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
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
|
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
|
return &response, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6876,10 +6876,18 @@
|
|||||||
"id": "app.status.get.missing.app_error",
|
"id": "app.status.get.missing.app_error",
|
||||||
"translation": "No entry for that status exists."
|
"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",
|
"id": "app.submit_interactive_dialog.json_error",
|
||||||
"translation": "Encountered an error encoding JSON for the interactive dialog."
|
"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",
|
"id": "app.system.complete_onboarding_request.app_error",
|
||||||
"translation": "Failed to decode the complete onboarding request."
|
"translation": "Failed to decode the complete onboarding request."
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user