Furthermore, the variable mailid is read before it is created, and then not used
I will revert On Sat, 1 Jan 2022 at 00:48, sebb <[email protected]> wrote: > > On Fri, 31 Dec 2021 at 18:30, <[email protected]> wrote: > > > > 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 > > > > > > The following commit(s) were added to refs/heads/master by this push: > > new 3d78afb allow for + in message-id here > > 3d78afb is described below > > > > commit 3d78afbf62d15bf7af3e822791d3dab5d36f0316 > > Author: Daniel Gruno <[email protected]> > > AuthorDate: Fri Dec 31 19:30:43 2021 +0100 > > > > allow for + in message-id here > > --- > > server/endpoints/source.py | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/server/endpoints/source.py b/server/endpoints/source.py > > index ce25d68..9fa1b3e 100644 > > --- a/server/endpoints/source.py > > +++ b/server/endpoints/source.py > > @@ -27,12 +27,16 @@ import plugins.aaa > > async def process( > > server: plugins.server.BaseServer, session: > > plugins.session.SessionObject, indata: dict, > > ) -> aiohttp.web.Response: > > + 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: > > - email = await plugins.messages.get_email(session, > > messageid=indata.get("id"), listid=indata.get("list", "")) > > + 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(" ", "+") > > -1 > > This will not work if there is a mix of space and plus. > > The proper solution is to ensure that the correct encoding is used in the URL. > e.g. '+' must be encoded if it is used in a query > > The code that generates the URL needs to ensure it applies the correct > encoding depending on which part of the URL is being constructed. > > > + 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):
