diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2024-01-29 16:18:09 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2024-01-29 16:18:09 -0500 |
commit | 8b26de088d25a3c2dee077bd721c0e8345284e7e (patch) | |
tree | 0ffc0505ac7a844763ae47e9825494f63d432734 | |
parent | c9b6a695ebb479970389819e5a269983e97a7535 (diff) | |
download | b4-8b26de088d25a3c2dee077bd721c0e8345284e7e.tar.gz |
pr: fix crash when GH pull request body is "None"
Using a dict.get() method doesn't work when the key is actually defined
but set to None. In this case we have to actually check that it's a
usable value.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/pr.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -385,7 +385,10 @@ def get_pr_from_github(ghurl: str) -> Optional[b4.LoreMessage]: created_at = utils.format_datetime(datetime.strptime(prdata.get('created_at'), '%Y-%m-%dT%H:%M:%SZ')) msg['Date'] = created_at msg.set_charset('utf-8') - msg.set_payload(prdata.get('body', '(no body)'), charset='utf-8') + body = prdata.get('body') + if not body: + body = '' + msg.set_payload(body, charset='utf-8') lmsg = b4.LoreMessage(msg) lmsg.pr_base_commit = base.get('sha') lmsg.pr_repo = repo.get('clone_url') |