fix: Better validation of links, fixes #1745

- move to the built in url validation instead of the regex we used before
pull/1754/head
iglocska 2016-12-12 10:00:44 +01:00
parent b0837fd24f
commit aaaaaa0523
1 changed files with 1 additions and 1 deletions

View File

@ -756,7 +756,7 @@ class Attribute extends AppModel {
$returnValue = true;
break;
case 'link':
if (preg_match('#^(http|ftp)(s)?\:\/\/((([a-z|0-9|\-]{1,25})(\.)?){2,7})($|/.*$)#i', $value) && !preg_match("#\n#", $value)) {
if (filter_var($value, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) && !preg_match("#\n#", $value)) {
$returnValue = true;
}
break;