You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2025/08/01 14:27:10 UTC
(tooling-trusted-release) branch main updated: Fix the code to get an email address and Message-Id from a thread
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new 1d2844d Fix the code to get an email address and Message-Id from a thread
1d2844d is described below
commit 1d2844dd1d7327b83f638f251fb6101e307cfba8
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Fri Aug 1 15:25:57 2025 +0100
Fix the code to get an email address and Message-Id from a thread
---
atr/util.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/atr/util.py b/atr/util.py
index b15d4da..c28c6e4 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -289,11 +289,17 @@ def email_from_uid(uid: str) -> str | None:
async def email_mid_from_thread_id(thread_id: str) -> tuple[str, str]:
- async for msg_id, msg_json in thread_messages(thread_id):
- email_to = email_from_uid(msg_json.get("to", ""))
+ async for _thread_id, msg_json in thread_messages(thread_id):
+ # The .get("to", "") value may be redacted, e.g. "us...@tooling.apache.org"
+ # Therefore use .get("forum", "")
+ email_to = msg_json.get("forum", "")
if email_to is None:
- raise RuntimeError(f"Cannot find email address for {msg_id}")
- return email_to, msg_id
+ raise RuntimeError(f"Cannot find email address for {thread_id}")
+ # This is delimited by angle brackets, e.g. "<12...@apache.org>"
+ message_id = msg_json.get("message-id", "")
+ if message_id is None:
+ raise RuntimeError(f"Cannot find message ID for {thread_id}")
+ return email_to, message_id
raise RuntimeError(f"Cannot find any messages in {thread_id}")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org