diff --git a/inc/toolbox.class.php b/inc/toolbox.class.php index b0c391fff31..676cae01cb1 100644 --- a/inc/toolbox.class.php +++ b/inc/toolbox.class.php @@ -3461,7 +3461,7 @@ public static function isAPIDeprecated(string $class): bool { */ public static function isValidWebUrl($url): bool { return (preg_match( - '#^http[s]?://[a-z0-9\-_]+(\.([a-z0-9\-]+\.)?[a-z]+)?(:\d+)?(/.*)?$#i', + '#^http[s]?://[a-z0-9\-_]+(\.([a-z0-9\-]+\.)*[a-z]+)?(:\d+)?(/.*)?$#i', $url ) === 1); } diff --git a/tests/units/Toolbox.php b/tests/units/Toolbox.php index 29f0ef1d8e5..9ec2f7af3a4 100644 --- a/tests/units/Toolbox.php +++ b/tests/units/Toolbox.php @@ -909,6 +909,8 @@ protected function urlProvider() { ['http://my.host.com:8080 /', false], ['http://my.host.com: 8080/', false], ['http://my.host.com :8080/', false], + ['http://helpdesk.global.glpi-project.org', true], + ['http://dev.helpdesk.global.glpi-project.org', true], ]; }