diff options
-rw-r--r-- | b4/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 5b0bb6e..995bd7e 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -2367,10 +2367,16 @@ def get_msgid(cmdargs: argparse.Namespace) -> Optional[str]: msgid = urllib.parse.unquote(chunks[0]) return msgid - # Is it a lore URL? + # Does it look like a public-inbox URL? matches = re.search(r'^https?://[^/]+/([^/]+)/([^/]+@[^/]+)', msgid, re.IGNORECASE) if matches: chunks = matches.groups() + config = get_main_config() + myloc = urllib.parse.urlparse(config['midmask']) + wantloc = urllib.parse.urlparse(msgid) + if myloc.netloc != wantloc.netloc: + logger.debug('Overriding midmask with passed url parameters') + config['midmask'] = f'{wantloc.scheme}://{wantloc.netloc}/{chunks[0]}/%s' msgid = urllib.parse.unquote(chunks[1]) # Infer the project name from the URL, if possible if chunks[0] != 'r': |