Stephen Finucane <step...@that.guru> writes:
> diff --git patchwork/parser.py patchwork/parser.py
> index e6e1a7fb..17cc2325 100644
> --- patchwork/parser.py
> +++ patchwork/parser.py
> @@ -31,6 +31,7 @@ from patchwork.models import SeriesReference
>  from patchwork.models import State
>  
>  
> +_msgid_re = re.compile(r'<[^>]+>')

Ok; a msgid is <something> and we don't support <> (empty) msgid

>      if 'In-Reply-To' in mail:
>          for in_reply_to in mail.get_all('In-Reply-To'):
> -            r = clean_header(in_reply_to)
> -            if r:
> -                refs.append(r)
> +            ref = _msgid_re.search(clean_header(in_reply_to))
> +            if ref:
> +                refs.append(ref.group(0))

Instead of appending the header as-is, we extract all <*> patterns, OK.
Would have the same effect if the string only had a msgid in it.

>      if 'References' in mail:
>          for references_header in mail.get_all('References'):
> -            h = clean_header(references_header)
> -            if not h:
> -                continue
> -            references = h.split()
> +            references = _msgid_re.findall(clean_header(references_header))
>              references.reverse()
>              for ref in references:
> -                ref = ref.strip()
>                  if ref not in refs:
>                      refs.append(ref)

Likewise OK.

> diff --git patchwork/tests/test_parser.py patchwork/tests/test_parser.py

The rest looks all OK to me, without needing line-by-line review.

Thanks!
Reviewed-by: DJ Delorie <d...@redhat.com>

_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to