Skip to content

Commit

Permalink
Decode pull request cover letter
Browse files Browse the repository at this point in the history
The following pull request cover letter is encoded with
Content-Transfer-Encoding: base64 and is currently not parsed correctly
by build_patch():

  https://lore.kernel.org/qemu-devel/20231019021733.2258592-1-bcain@quicinc.com/

Use the message.get_payload() helper function to decode the
Content-Transfer-Encoding.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
stefanhaRH committed Oct 30, 2023
1 parent 01ac368 commit 35531a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions patchlib/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,13 @@ def build_patch(commits, merged_heads, msg, trees, leader=False):
stripped_subject = sub['subject']

if 'pull-request' in sub and sub['pull-request']:
parts = msg.get_message_parts()
patch['pull-request'] = {}

extract_repo = False
for line in parts[0].get_payload().split('\n'):
for line in message.get_payload(msg).split('\n'):
stripped_line = line.strip()

if stripped_line == 'are available in the git repository at:':
if stripped_line.lower() == 'are available in the git repository at:':
extract_repo = True
elif extract_repo and stripped_line:
extract_repo = False
Expand Down

0 comments on commit 35531a8

Please sign in to comment.