[MM-54024] Handle JSON nulls when unmarshalling in api4 (#24656)
* handle JSON nulls when unmarshalling in api4 * catch more cases of unhandled JSON null * fix lint issues * remove unnecessary checks * add bot tests for null values * fix bot_test lint * add channel null tests * add group null tests * add notify_admin null tests --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5b25519890
Коммит
d61364a24a
@@ -13,7 +13,7 @@ import (
|
||||
func handleNotifyAdmin(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
var notifyAdminRequest *model.NotifyAdminToUpgradeRequest
|
||||
err := json.NewDecoder(r.Body).Decode(¬ifyAdminRequest)
|
||||
if err != nil {
|
||||
if err != nil || notifyAdminRequest == nil {
|
||||
c.SetInvalidParamWithErr("notifyAdminRequest", err)
|
||||
return
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func handleTriggerNotifyAdminPosts(c *Context, w http.ResponseWriter, r *http.Re
|
||||
|
||||
var notifyAdminRequest *model.NotifyAdminToUpgradeRequest
|
||||
err := json.NewDecoder(r.Body).Decode(¬ifyAdminRequest)
|
||||
if err != nil {
|
||||
if err != nil || notifyAdminRequest == nil {
|
||||
c.SetInvalidParamWithErr("notifyAdminRequest", err)
|
||||
return
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user