From a83a3b430271b94e0fb3fd5fe595f79ffcfc9677 Mon Sep 17 00:00:00 2001 From: Lukas Lengler Date: Tue, 13 Aug 2024 12:38:49 +0200 Subject: [PATCH] Fix error when entering correct URLs with ports (Invalid format given) --- ChangeLog | 2 ++ share/server/core/defines/matches.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99e3ac39..b95c0338 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 1.9.43 +Core: + * FIX: Fix error when entering correct URLs with ports (Invalid format given) 1.9.42 Security: diff --git a/share/server/core/defines/matches.php b/share/server/core/defines/matches.php index 67de9207..4f46a537 100644 --- a/share/server/core/defines/matches.php +++ b/share/server/core/defines/matches.php @@ -40,8 +40,9 @@ define('MATCH_STRING_PATH', '/^[0-9a-z\s_.\-\/\\\]+$/i'); define('MATCH_STRING_PATH_AUTHORISATION', '/^(?!' . DISALLOWED_AUTHORISATION_PATHS . ')[0-9a-z\s_.\-\/\\\]+$/i'); define('MATCH_ALLOWED_URL_SCHEMES', '(http|https)'); -define('MATCH_STRING_URL', '/^(?:' . MATCH_ALLOWED_URL_SCHEMES . ':)?[0-9a-z\s;|+[\]()=%?&_,.\-#@=\/\\\~\{\}]+$/i'); -define('MATCH_STRING_URL_EMPTY', '/^(?:' . MATCH_ALLOWED_URL_SCHEMES . ':)?[0-9a-z\s;|+[\]()=%?&_,.\-#@=\/\\\~]*$/i'); +define('MATCH_PORT', '(?::[0-9]+)?'); +define('MATCH_STRING_URL', '/^(?:' . MATCH_ALLOWED_URL_SCHEMES . ':)?[0-9a-z\s;|+[\]()=%?&_,.\-#@=\/\\\~\{\}:]+' . MATCH_PORT . '$/i'); +define('MATCH_STRING_URL_EMPTY', '/^(?:' . MATCH_ALLOWED_URL_SCHEMES . ':)?[0-9a-z\s;|+[\]()=%?&_,.\-#@=\/\\\~:]*' . MATCH_PORT . '$/i'); define('MATCH_GADGET_OPT', '/^[0-9a-z\s:+[\]()_.,\-&?!#@=\/\\\%]+$/i'); define('MATCH_STRING_STYLE', '/^[0-9a-z:;\-+%#(),.]*$/i'); define('MATCH_COORDS', '/^(?:(?:[0-9]+)|([a-z0-9]+(?:%[+-][0-9]+)?))$/');