From c98266c09d3f03982c5bcdb3c0b67b1498c96794 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 29 Sep 2025 12:14:26 +0200 Subject: [PATCH] refactor(application): improve handling of docker compose domains by normalizing keys and ensuring valid JSON structure --- app/Models/Application.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Models/Application.php b/app/Models/Application.php index 836bb21c7..9fffdfcda 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -1477,13 +1477,14 @@ public function loadComposeFile($isInit = false) $this->save(); $parsedServices = $this->parse(); if ($this->docker_compose_domains) { - $json = collect(json_decode($this->docker_compose_domains)); + $decoded = json_decode($this->docker_compose_domains, true); + $json = collect(is_array($decoded) ? $decoded : []); + $normalized = collect(); foreach ($json as $key => $value) { - if (str($key)->contains('-') || str($key)->contains('.')) { - $key = str($key)->replace('-', '_')->replace('.', '_'); - } - $json->put((string) $key, $value); + $normalizedKey = (string) str($key)->replace('-', '_')->replace('.', '_'); + $normalized->put($normalizedKey, $value); } + $json = $normalized; $services = collect(data_get($parsedServices, 'services', [])); foreach ($services as $name => $service) { if (str($name)->contains('-') || str($name)->contains('.')) {