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:30 UTC

[incubator-ponymail-foal] 03/05: look up via message-id if we must, comment

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 6e1ecac076e830defdc027ceda1fc2fbc00c1a55
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Sep 7 11:42:20 2020 +0200

    look up via message-id if we must, comment
---
 server/endpoints/email.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/server/endpoints/email.py b/server/endpoints/email.py
index f12a4f2..b2de0b3 100644
--- a/server/endpoints/email.py
+++ b/server/endpoints/email.py
@@ -32,7 +32,14 @@ async def process(
     indata: dict,
 ) -> dict:
 
+    # 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 was found, process the request if we are allowed to display it
     if email and isinstance(email, dict):
         if plugins.aaa.can_access_email(session, email):
             # Are we fetching an attachment?