You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2022/01/04 01:45:46 UTC

[incubator-ponymail-foal] branch master updated (3d78afb -> 7eb007a)

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git.


    from 3d78afb  allow for + in message-id here
     new 5c431f1  Broken; also not a proper solution
     new 7eb007a  Simplify and eliminate unnecessary fetch

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 server/endpoints/email.py  | 12 +++++++-----
 server/endpoints/source.py | 13 ++++++-------
 server/endpoints/thread.py |  8 ++++++--
 3 files changed, 19 insertions(+), 14 deletions(-)

[incubator-ponymail-foal] 01/02: Broken; also not a proper solution

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 5c431f1e3a173181c10fde021ec760e46691eacf
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jan 4 01:41:31 2022 +0000

    Broken; also not a proper solution
---
 server/endpoints/source.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/server/endpoints/source.py b/server/endpoints/source.py
index 9fa1b3e..0a071b4 100644
--- a/server/endpoints/source.py
+++ b/server/endpoints/source.py
@@ -34,9 +34,6 @@ async def process(
     # If not found via permalink, it might be message-id instead, so try that
     if email is None:
         email = await plugins.messages.get_email(session, messageid=indata.get("id"), listid=listid)
-    if not email and ' ' in mailid: # only try again if we need to due to space in url
-        mailid = mailid.replace(" ", "+")
-        email = await plugins.messages.get_email(session, messageid=indata.get("id"), listid=listid)
 
     if email and isinstance(email, dict) and not email.get("deleted"):
         if plugins.aaa.can_access_email(session, email):

[incubator-ponymail-foal] 02/02: Simplify and eliminate unnecessary fetch

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 7eb007a17b3fe368ec4d12ae94192da35eda30f5
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jan 4 01:45:36 2022 +0000

    Simplify and eliminate unnecessary fetch
    
    message-id must be accompanied by list id
    and vice-versa
---
 server/endpoints/email.py  | 12 +++++++-----
 server/endpoints/source.py | 10 ++++++----
 server/endpoints/thread.py |  8 ++++++--
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/server/endpoints/email.py b/server/endpoints/email.py
index f23508e..affe4ca 100644
--- a/server/endpoints/email.py
+++ b/server/endpoints/email.py
@@ -32,12 +32,14 @@ async def process(
     server: plugins.server.BaseServer, session: plugins.session.SessionObject, indata: dict,
 ) -> typing.Union[dict, aiohttp.web.Response]:
 
-    # First, assume permalink and look up the email based on that
-    email = await plugins.messages.get_email(session, permalink=indata.get("id"))
+    # Has a list id been provided?
+    listid = indata.get("list", "")
 
-    # If not found via permalink, it might be message-id instead, so try that
-    if email is None:
-        email = await plugins.messages.get_email(session, messageid=indata.get("id"), listid=indata.get("list", ""))
+    # lookup by message id must always include a list id for disambiguation
+    if listid:
+        email = await plugins.messages.get_email(session, messageid=indata.get("id"), listid=listid)
+    else: # Else assume permalink and look up the email based on that
+        email = await plugins.messages.get_email(session, permalink=indata.get("id"))
 
     if email is None:
         return aiohttp.web.Response(headers={}, status=404, text="Email not found")
diff --git a/server/endpoints/source.py b/server/endpoints/source.py
index 0a071b4..0b7e24e 100644
--- a/server/endpoints/source.py
+++ b/server/endpoints/source.py
@@ -27,13 +27,15 @@ import plugins.aaa
 async def process(
     server: plugins.server.BaseServer, session: plugins.session.SessionObject, indata: dict,
 ) -> aiohttp.web.Response:
+
+    # Has a list id been provided?
     listid = indata.get("list", "")
-    # First, assume permalink and look up the email based on that
-    email = await plugins.messages.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:
+    # lookup by message id must always include a list id for disambiguation
+    if listid:
         email = await plugins.messages.get_email(session, messageid=indata.get("id"), listid=listid)
+    else: # Else assume permalink and look up the email based on that
+        email = await plugins.messages.get_email(session, permalink=indata.get("id"))
 
     if email and isinstance(email, dict) and not email.get("deleted"):
         if plugins.aaa.can_access_email(session, email):
diff --git a/server/endpoints/thread.py b/server/endpoints/thread.py
index b8dbe94..6ee9fab 100644
--- a/server/endpoints/thread.py
+++ b/server/endpoints/thread.py
@@ -28,9 +28,13 @@ async def process(
 ) -> typing.Optional[dict]:
     mailid = indata.get("id", "")
     listid = indata.get("list", "")
-    email = await plugins.messages.get_email(session, permalink=mailid)
-    if not email:
+
+    # lookup by message id must always include a list id for disambiguation
+    if listid:
         email = await plugins.messages.get_email(session, messageid=mailid, listid=listid)
+    else: # Else assume permalink and look up the email based on that
+        email = await plugins.messages.get_email(session, permalink=mailid)
+
     # The id is passed via the path thread/id
     # This means that + is converted into space
     # So we need to try both space and '+', and hope no msg ids contain both