Fixed #816 url validation

This commit is contained in:
TimZ99 2019-12-10 18:09:56 +01:00
parent 24ee6d02c4
commit 420211f61f
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
1 changed files with 1 additions and 1 deletions

View File

@ -89,7 +89,7 @@ class ServerValidator {
switch ($type) {
case 'website':
// url regex as per https://stackoverflow.com/a/3809435
if (!preg_match("/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,12}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g", $value)) {
if (!preg_match_all("/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,12}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/", $value)) {
throw new \InvalidArgumentException('server_ip_bad_website');
}
break;