From 8ff216e5fbc3222598c8e9548268285f746325d0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 3 Oct 2023 12:20:09 +0200 Subject: [PATCH] revert --- app/Models/Service.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index fe7ecc281..49d8b9f33 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -8,7 +8,6 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; use Symfony\Component\Yaml\Yaml; use Illuminate\Support\Str; -use Spatie\Url\Url; class Service extends BaseModel { @@ -260,7 +259,7 @@ class Service extends BaseModel $networks = $serviceNetworks->toArray(); foreach ($definedNetwork as $key => $network) { $networks = array_merge($networks, [ - $network => null + $network ]); } data_set($service, 'networks', $networks); @@ -289,7 +288,10 @@ class Service extends BaseModel $isDirectory = (bool) data_get($volume, 'isDirectory', false); $foundConfig = $savedService->fileStorages()->whereMountPath($target)->first(); if ($foundConfig) { - $content = data_get($foundConfig, 'content'); + $contentNotNull = data_get($foundConfig, 'content'); + if ($contentNotNull) { + $content = $contentNotNull; + } $isDirectory = (bool) data_get($foundConfig, 'is_directory'); } } @@ -317,11 +319,7 @@ class Service extends BaseModel ); } else if ($type->value() === 'volume') { $slug = Str::slug($source, '-'); - if ($isNew) { - $name = "{$savedService->service->uuid}-{$slug}"; - } else { - $name = "{$savedService->service->uuid}_{$slug}"; - } + $name = "{$savedService->service->uuid}_{$slug}"; if (is_string($volume)) { $source = Str::of($volume)->before(':'); $target = Str::of($volume)->after(':')->beforeLast(':'); @@ -345,7 +343,7 @@ class Service extends BaseModel ] ); } - $savedService->getFilesFromServer(); + $savedService->getFilesFromServer(isInit: true); return $volume; }); data_set($service, 'volumes', $serviceVolumes->toArray());