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/02/02 13:41:52 UTC

[incubator-ponymail-foal] branch master updated (7929666 -> eed3275)

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 7929666  Changed error reporting
     new c926127  validate list name
     new eed3275  Bump server version

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/mgmt.py  | 8 +++++++-
 server/server_version.py  | 2 +-
 test/itest_integration.py | 6 ++++++
 3 files changed, 14 insertions(+), 2 deletions(-)

[incubator-ponymail-foal] 01/02: validate list name

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 c92612797b5e25eaac69b261612efb0845e0ca9b
Author: Sebb <se...@apache.org>
AuthorDate: Wed Feb 2 13:41:18 2022 +0000

    validate list name
    
    This fixes #228
---
 server/endpoints/mgmt.py  | 8 +++++++-
 test/itest_integration.py | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/server/endpoints/mgmt.py b/server/endpoints/mgmt.py
index 7f47781..8a0dfe5 100644
--- a/server/endpoints/mgmt.py
+++ b/server/endpoints/mgmt.py
@@ -166,6 +166,12 @@ async def process(
         if new_body and not isinstance(new_body, str):
             return user_error("Email body must be a text string!")
 
+        # extra list validation
+        if new_list:
+            new_forum = new_list.strip("<>").replace(".", "@", 1)
+            if not new_forum in server.data.lists:
+                return user_error(f"New list id: '{new_forum}' is not an existing list")
+
         email = await plugins.messages.get_email(session, permalink=doc)
         if email:
 
@@ -203,7 +209,7 @@ async def process(
                 if not new_lid == origin_lid:
                     email["list"] = new_lid
                     email["list_raw"] = new_lid
-                    email["forum"] = new_lid.strip("<>").replace(".", "@", 1)
+                    email["forum"] = new_forum
                     changes.append(f"Listid {origin_lid} => {new_lid}")
                     hide_source = True
 
diff --git a/test/itest_integration.py b/test/itest_integration.py
index 606a4cd..4a5ff21 100644
--- a/test/itest_integration.py
+++ b/test/itest_integration.py
@@ -245,6 +245,12 @@ def test_mgmt_validation():
     text = mgmt_get_text({"action": 'edit', "document": 'abcd', "list": "True"}, admin_cookies, 400)
     assert "List ID field must match" in text
 
+    text = mgmt_get_text({"action": 'edit', "document": 'abcd', "list": "a.b.c.d"}, admin_cookies, 400)
+    assert "is not an existing list" in text
+
+    text = mgmt_get_text({"action": 'edit', "document": 'abcd', "list": "dev.ponymail.apache.org"}, admin_cookies, 404)
+    assert "Email not found!" in text
+
     text = mgmt_get_text(
         {"action": 'edit', "document": 'abcd', "body": 1234}, admin_cookies, 400)
     assert "Email body" in text

[incubator-ponymail-foal] 02/02: Bump server version

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 eed32755a602ecc6b237fdeb1f753e36015515f2
Author: Sebb <se...@apache.org>
AuthorDate: Wed Feb 2 13:41:31 2022 +0000

    Bump server version
---
 server/server_version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/server_version.py b/server/server_version.py
index 9543b0c..3e72025 100644
--- a/server/server_version.py
+++ b/server/server_version.py
@@ -1,2 +1,2 @@
 # This file is generated by server/update_version.sh
-PONYMAIL_SERVER_VERSION = '4d72fcd'
+PONYMAIL_SERVER_VERSION = 'c926127'