MM-30826: Sentry crash: nil deference in model.AuthorizeRequest (#16563)

The return statement after setting c.InvalidParam was missing

https://mattermost.atlassian.net/browse/MM-30826

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2020-12-16 14:26:06 +05:30
коммит произвёл GitHub
родитель 8496cb6977
Коммит dae95dd373
2 изменённых файлов: 11 добавлений и 0 удалений

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

@@ -46,6 +46,7 @@ func authorizeOAuthApp(c *Context, w http.ResponseWriter, r *http.Request) {
authRequest := model.AuthorizeRequestFromJson(r.Body)
if authRequest == nil {
c.SetInvalidParam("authorize_request")
return
}
if err := authRequest.IsValid(); err != nil {

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

@@ -129,6 +129,16 @@ func TestAuthorizeOAuthApp(t *testing.T) {
CheckNotFoundStatus(t, resp)
}
func TestNilAuthorizeOAuthApp(t *testing.T) {
th := Setup(t).InitBasic()
th.Login(ApiClient, th.SystemAdminUser)
defer th.TearDown()
_, resp := ApiClient.AuthorizeOAuthApp(nil)
require.NotNil(t, resp.Error)
assert.Equal(t, "api.context.invalid_body_param.app_error", resp.Error.Id)
}
func TestDeauthorizeOAuthApp(t *testing.T) {
th := Setup(t).InitBasic()
th.Login(ApiClient, th.SystemAdminUser)