Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

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

peaklabs-deve53c71908f46
diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php
index dfc67bfae6..701c92d4d9 100644
--- a/app/Http/Controllers/Api/ApplicationsController.php
+++ b/app/Http/Controllers/Api/ApplicationsController.php
@@ -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;
diff --git a/bootstrap/helpers/api.php b/bootstrap/helpers/api.php
index c23f55c126..d5c2c996b9 100644
--- a/bootstrap/helpers/api.php
+++ b/bootstrap/helpers/api.php
@@ -90,7 +90,7 @@ function sharedDataApplications()
'is_auto_deploy_enabled' => 'boolean',
'is_force_https_enabled' => 'boolean',
'static_image' => Rule::enum(StaticImageTypes::class),
- 'domains' => 'string',
+ 'domains' => 'string|nullable',
'redirect' => Rule::enum(RedirectTypes::class),
'git_commit_sha' => 'string',
'docker_registry_image_name' => 'string|nullable',