From 5d6ee04991c51f7ec7ecc659a0e963d9262eb986 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 09:18:32 +0200 Subject: [PATCH] fix: new volumes for services should have - instead of _ --- app/Models/Service.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index cfbfeaf48..05be5fef4 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -248,7 +248,7 @@ public function parse(bool $isNew = false): Collection // Collect/create/update volumes if ($serviceVolumes->count() > 0) { - $serviceVolumes = $serviceVolumes->map(function ($volume) use ($savedService, $topLevelVolumes) { + $serviceVolumes = $serviceVolumes->map(function ($volume) use ($savedService, $topLevelVolumes, $isNew) { $type = null; $source = null; $target = null; @@ -298,7 +298,11 @@ public function parse(bool $isNew = false): Collection ); } 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(':'); @@ -323,8 +327,6 @@ public function parse(bool $isNew = false): Collection ); } $savedService->getFilesFromServer(); - ray($volume); - return $volume; }); data_set($service, 'volumes', $serviceVolumes->toArray());