fix(api): if domains field is empty clear the fqdn column

- providing an empty string for `domains` allows the ability to remove all URLs from the domains field
This commit is contained in:
peaklabs-dev
2026-01-15 13:12:49 +01:00
parent 161e0d2b05
commit e53c71908f
2 changed files with 13 additions and 1 deletions

View File

@@ -2577,6 +2577,12 @@ class ApplicationsController extends Controller
$errors = [];
$urls = str($urls)->trim()->explode(',')->map(function ($url) use (&$errors) {
$url = trim($url);
// If "domains" is empty clear all URLs from the fqdn column
if (blank($url)) {
return null;
}
if (! filter_var($url, FILTER_VALIDATE_URL)) {
$errors[] = 'Invalid URL: '.$url;
@@ -3841,6 +3847,12 @@ class ApplicationsController extends Controller
$errors = [];
$urls = str($urls)->trim()->explode(',')->map(function ($url) use (&$errors) {
$url = trim($url);
// If "domains" is empty clear all URLs from the fqdn column
if (blank($url)) {
return null;
}
if (! filter_var($url, FILTER_VALIDATE_URL)) {
$errors[] = 'Invalid URL: '.$url;