diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-11-06 07:56:44 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-11-06 07:56:44 -0500 |
commit | 85ff23f82313f7e4383f0833c77d2f1016a6e4dd (patch) | |
tree | fbf8a1747df2242af54d18fd18a3e5803a52e272 /web | |
parent | de5e97167d1df2fb6c24cbff32347c4862972aa9 (diff) | |
parent | c1baee398493434f7684f2db5ad48cc4b1b59279 (diff) | |
download | chat-85ff23f82313f7e4383f0833c77d2f1016a6e4dd.tar.gz chat-85ff23f82313f7e4383f0833c77d2f1016a6e4dd.tar.bz2 chat-85ff23f82313f7e4383f0833c77d2f1016a6e4dd.zip |
Merge pull request #1329 from florianorben/no_panic_on_webhook_err
don't panic if incoming webhook contains invalid json
Diffstat (limited to 'web')
-rw-r--r-- | web/web.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/web/web.go b/web/web.go index 51f6664b6..96f826359 100644 --- a/web/web.go +++ b/web/web.go @@ -983,6 +983,11 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) { parsedRequest = model.IncomingWebhookRequestFromJson(strings.NewReader(r.FormValue("payload"))) } + if parsedRequest == nil { + c.Err = model.NewAppError("incomingWebhook", "Unable to parse incoming data", "") + return + } + text := parsedRequest.Text if len(text) == 0 { c.Err = model.NewAppError("incomingWebhook", "No text specified", "") |