fix(domains): trim whitespace from domains before validation
This commit is contained in:
@@ -3380,11 +3380,12 @@ class ApplicationsController extends Controller
|
|||||||
$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([
|
||||||
|
Reference in New Issue
Block a user