You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/07 09:44:32 UTC
[incubator-ponymail-foal] 05/05: this should support lookups via
message-id as well, for old times sake
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 842c59a19d62e800c2c290499f28cff40f4c6d77
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Sep 7 11:44:15 2020 +0200
this should support lookups via message-id as well, for old times sake
---
server/endpoints/source.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/server/endpoints/source.py b/server/endpoints/source.py
index 6164694..c298667 100644
--- a/server/endpoints/source.py
+++ b/server/endpoints/source.py
@@ -29,8 +29,13 @@ async def process(
session: plugins.session.SessionObject,
indata: dict,
) -> aiohttp.web.Response:
-
+ # First, assume permalink and look up the email based on that
email = await plugins.mbox.get_email(session, permalink=indata.get("id"))
+
+ # If not found via permalink, it might be message-id instead, so try that
+ if email is None:
+ email = await plugins.mbox.get_email(session, messageid=indata.get("id"))
+
if email and isinstance(email, dict):
if plugins.aaa.can_access_email(session, email):
source = await plugins.mbox.get_source(session, permalink=email["mid"])