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 2021/09/27 13:31:07 UTC

[incubator-ponymail-foal] branch master updated: Fix domain name extraction

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


The following commit(s) were added to refs/heads/master by this push:
     new d00731d  Fix domain name extraction
d00731d is described below

commit d00731d9a8e6f65d6a334cb9251035a4a7e07bb2
Author: Sebb <se...@apache.org>
AuthorDate: Mon Sep 27 14:30:57 2021 +0100

    Fix domain name extraction
    
    This fixes #106
---
 server/plugins/oauthGeneric.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/plugins/oauthGeneric.py b/server/plugins/oauthGeneric.py
index 027747b..77c2d0f 100644
--- a/server/plugins/oauthGeneric.py
+++ b/server/plugins/oauthGeneric.py
@@ -24,7 +24,9 @@ import aiohttp.client
 
 async def process(formdata, _session, _server):
     js = None
-    m = re.match(r"https?://(.+)/", formdata["oauth_token"])
+    # Extract domain, allowing for :port
+    # Does not handle user/password prefix etc
+    m = re.match(r"https?://([^/:]+)(?::\d+)?/", formdata["oauth_token"])
     if m:
         oauth_domain = m.group(1)
         headers = {"User-Agent": "Pony Mail OAuth Agent/0.1"}