diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 90d13edb8..d433d2987 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -886,7 +886,7 @@ class Config 'type' => 'string', 'description' => 'Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes)', 'default' => /** @lang RegExp */ - '(https?|ftp)\://([a-zA-Z0-9+!*(),;?&=\$_.-]+(\:[a-zA-Z0-9+!*(),;?&=\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\:[0-9]{2,5})?(/([a-zA-Z0-9:%+\$_-]\.?)+)*/?(\?[a-zA-Z+&\$_.-][a-zA-Z0-9;:[\]@&%=+/\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\$_.-]*)?', + '(https?|ftp)\://([a-zA-Z0-9+!*(),;?&=\$_.-]+(\:[a-zA-Z0-9+!*(),;?&=\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\:[0-9]{2,5})?(/([a-zA-Z0-9:%+\$_-]\.?)+)*/?(\?[a-zA-Z+&\$_.-][a-zA-Z0-9;:[\]@&%=+/\$_.-]*)?(#[a-zA-Z0-9_.-][a-zA-Z0-9+\$_.-]*)?', // SCHEME....... USER....................... PASSWORD.......................... HOST/IP........... PORT.......... PATH......................... GET............................................ ANCHOR.......................... // Example: http://User:passWord@127.0.0.1:8888/patH/Page.php?arrayArgument[2]=something:blah20#myAnchor // RegExp source: http://www.php.net/manual/fr/function.preg-match.php#93824 diff --git a/test/core/AttributeURLDefaultPattern.php b/test/core/AttributeURLDefaultPattern.php index bf647db2d..9230bbd4b 100644 --- a/test/core/AttributeURLDefaultPattern.php +++ b/test/core/AttributeURLDefaultPattern.php @@ -9,6 +9,6 @@ class AttributeURLDefaultPattern extends AttributeURL { { /** @noinspection OneTimeUseVariablesInspection */ $oConfig = utils::GetConfig(); - return $oConfig->GetDefault('url_validation_pattern'); + return '^'.$oConfig->GetDefault('url_validation_pattern').'$'; } } diff --git a/test/core/AttributeURLTest.php b/test/core/AttributeURLTest.php index 5f937830a..1eda57464 100644 --- a/test/core/AttributeURLTest.php +++ b/test/core/AttributeURLTest.php @@ -39,6 +39,7 @@ class AttributeURLTest extends ItopTestCase { 'Sharepoint URL 2' => ['https://mydomain2.sharepoint.com/:u:/r/sites/DIS/ITSM/00_Admin_iTOP/iTop%20-%20Upgrade%20manuel/Procedure%20upgrade%20Combodo.url?csf=1&web=1&e=DAF0i3', 1], 'Alfresco URL 2' => ['http://alfresco.mydomain3.org/share/page/site/books/document-details?nodeRef=workspace://SpacesStore/6274f55f-a25b-4762-a863-77f7066f2034', 1], 'SF URL' => ['https://sourceforge.net/p/itop/discussion/customizing-itop/thread/707145b859/?limit=25#f53c', 1], + 'SF URL anchor starting with digit' => ['https://sourceforge.net/p/itop/discussion/customizing-itop/thread/b0a2d474ba/?limit=25#2b35', 1], ]; } }