From 39b9dc3a2399f3ef0a1a321dcb58fb11b0871ca8 Mon Sep 17 00:00:00 2001 From: Johann Frei Date: Wed, 14 Apr 2021 20:35:14 +0200 Subject: [PATCH] Improve regex pattern --- offline_deployment/offline_patcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/offline_deployment/offline_patcher.py b/offline_deployment/offline_patcher.py index 47b27b44..21bcaa9a 100644 --- a/offline_deployment/offline_patcher.py +++ b/offline_deployment/offline_patcher.py @@ -17,7 +17,7 @@ def main(): mime_ptn = re.compile(r"(?P(?P[\w^\/]+)\/(?P[\S\.^\;]+))(\;|$)", re.IGNORECASE) #link_ptn = re.compile(r"(?P[\S\"\'])(?Phttps?:\/\/(?P[\S^:\/)]+)(?P\:[0-9]+)?\/((?!(?P=encl)).)+)(?P=encl)", re.IGNORECASE) - link_ptn = re.compile(r"[\(\'\"\ ](?Phttps?:\/\/(?P[\S^:\/)]+)(?P\:[0-9]+)?\/[^\(\)\'\"\ ]+)(?P[\(\)\'\"\ ])") + link_ptn = re.compile(r"[\(\'\"\ ](?Phttps?:\/\/(?P(?P((?=[^\:\/])(?=[\S]).)+))(?P\:[0-9]+)?\/[^\(\)\'\"\ ]+)(?P[\(\)\'\"\ ])") # Block special hosts forbidden_hosts = [