diff --git a/app/Models/Service.php b/app/Models/Service.php index 49d8b9f33..fe7ecc281 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -8,6 +8,7 @@ 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 { @@ -259,7 +260,7 @@ class Service extends BaseModel $networks = $serviceNetworks->toArray(); foreach ($definedNetwork as $key => $network) { $networks = array_merge($networks, [ - $network + $network => null ]); } data_set($service, 'networks', $networks); @@ -288,10 +289,7 @@ class Service extends BaseModel $isDirectory = (bool) data_get($volume, 'isDirectory', false); $foundConfig = $savedService->fileStorages()->whereMountPath($target)->first(); if ($foundConfig) { - $contentNotNull = data_get($foundConfig, 'content'); - if ($contentNotNull) { - $content = $contentNotNull; - } + $content = data_get($foundConfig, 'content'); $isDirectory = (bool) data_get($foundConfig, 'is_directory'); } } @@ -319,7 +317,11 @@ class Service extends BaseModel ); } else if ($type->value() === 'volume') { $slug = Str::slug($source, '-'); - $name = "{$savedService->service->uuid}_{$slug}"; + if ($isNew) { + $name = "{$savedService->service->uuid}-{$slug}"; + } else { + $name = "{$savedService->service->uuid}_{$slug}"; + } if (is_string($volume)) { $source = Str::of($volume)->before(':'); $target = Str::of($volume)->after(':')->beforeLast(':'); @@ -343,7 +345,7 @@ class Service extends BaseModel ] ); } - $savedService->getFilesFromServer(isInit: true); + $savedService->getFilesFromServer(); return $volume; }); data_set($service, 'volumes', $serviceVolumes->toArray());