zulip/zerver/webhooks/github
Eeshan Garg 4c0890e8b0 webhooks/github: Handle empty 'requested_reviewers' key.
We recently received a bug report that implied that for certain
payloads, the `requested_reviewers` key was empty whereas a
singular `requested_reviewer` key containing one reviewer's
information was present in its stead. Naturally, this raised
some not so pretty IndexError exceptions.

After some investigation and generating a few similar payloads,
I discovered that in every case both the `requested_reviewers`
and the `requested_reviewer` keys were correctly populated, so I
had to manually edit the payload to reproduce the error on my end.

My guess is that this anomaly goes back to when GitHub's reviewer
request feature was new and didn't support requesting multiple
reviewers, and that the singular `requested_reviewer` key could
possibly just be there for backwards compatibility or might just
be mere oversight. Either way, the solution here is to look for the
plural `requested_reviewers` key, and if that is empty, fall back
to the singular `requested_reviewer` key.
2018-10-23 14:41:24 -07:00
..
fixtures webhooks/github: Handle empty 'requested_reviewers' key. 2018-10-23 14:41:24 -07:00
__init__.py webhooks: Move github_webhook/ to github/. 2018-04-19 11:00:55 -07:00
doc.md webhooks: Move github_webhook/ to github/. 2018-04-19 11:00:55 -07:00
tests.py webhooks/github: Handle empty 'requested_reviewers' key. 2018-10-23 14:41:24 -07:00
view.py webhooks/github: Handle empty 'requested_reviewers' key. 2018-10-23 14:41:24 -07:00