fix(domains): trim whitespace from domains before validation
This commit is contained in:
parent
4fc62ea33f
commit
a463a562ec
1 changed files with 2 additions and 1 deletions
|
|
@ -3380,11 +3380,12 @@ private function validateDataApplications(Request $request, Server $server)
|
||||||
$fqdn = str($fqdn)->replaceStart(',', '')->trim();
|
$fqdn = str($fqdn)->replaceStart(',', '')->trim();
|
||||||
$errors = [];
|
$errors = [];
|
||||||
$fqdn = str($fqdn)->trim()->explode(',')->map(function ($domain) use (&$errors) {
|
$fqdn = str($fqdn)->trim()->explode(',')->map(function ($domain) use (&$errors) {
|
||||||
|
$domain = trim($domain);
|
||||||
if (filter_var($domain, FILTER_VALIDATE_URL) === false) {
|
if (filter_var($domain, FILTER_VALIDATE_URL) === false) {
|
||||||
$errors[] = 'Invalid domain: '.$domain;
|
$errors[] = 'Invalid domain: '.$domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str($domain)->trim()->lower();
|
return str($domain)->lower();
|
||||||
});
|
});
|
||||||
if (count($errors) > 0) {
|
if (count($errors) > 0) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue