[v2] tools: fix parsing message-id in the headers of email

Message ID 20231214024714.26763-1-zhoumin@loongson.cn (mailing list archive)
State New
Headers
Series [v2] tools: fix parsing message-id in the headers of email |

Commit Message

Min Zhou Dec. 14, 2023, 2:47 a.m. UTC
  Some email has the message-id header named "Message-id", like this:
https://patches.dpdk.org/project/dpdk/patch/20230930010024.34377-1-rdna@apple.com/.

This patch passes Message-[iI][dD] as the header argument to
getheader function.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Min Zhou <zhoumin@loongson.cn>
---
 tools/parse-email.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Aaron Conole Dec. 20, 2023, 1:37 p.m. UTC | #1
Min Zhou <zhoumin@loongson.cn> writes:

> Some email has the message-id header named "Message-id", like this:
> https://patches.dpdk.org/project/dpdk/patch/20230930010024.34377-1-rdna@apple.com/.
>
> This patch passes Message-[iI][dD] as the header argument to
> getheader function.
>
> Acked-by: Aaron Conole <aconole@redhat.com>
> Signed-off-by: Min Zhou <zhoumin@loongson.cn>
> ---

Thanks, applied!

>  tools/parse-email.sh | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/parse-email.sh b/tools/parse-email.sh
> index 9cb9583..de8b5bb 100755
> --- a/tools/parse-email.sh
> +++ b/tools/parse-email.sh
> @@ -33,8 +33,7 @@ getheader () # <header_name> <email_file>
>  
>  subject=$(getheader Subject "$1")
>  from=$(getheader From "$1")
> -msgid=$(getheader Message-Id "$1")
> -[ -n "$msgid" ] || msgid=$(getheader Message-ID "$1")
> +msgid=$(getheader Message-[iI][dD] "$1")
>  pwid=$(getheader X-Patchwork-Id "$1")
>  listid=$(getheader List-Id "$1")
>  reply=$(getheader In-Reply-To "$1")
  

Patch

diff --git a/tools/parse-email.sh b/tools/parse-email.sh
index 9cb9583..de8b5bb 100755
--- a/tools/parse-email.sh
+++ b/tools/parse-email.sh
@@ -33,8 +33,7 @@  getheader () # <header_name> <email_file>
 
 subject=$(getheader Subject "$1")
 from=$(getheader From "$1")
-msgid=$(getheader Message-Id "$1")
-[ -n "$msgid" ] || msgid=$(getheader Message-ID "$1")
+msgid=$(getheader Message-[iI][dD] "$1")
 pwid=$(getheader X-Patchwork-Id "$1")
 listid=$(getheader List-Id "$1")
 reply=$(getheader In-Reply-To "$1")