From 66d0926142356813c26871166e156278379ded73 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:00:49 +0100 Subject: [PATCH] fix: `Undefined variable $fs_path` for databases --- app/Livewire/Project/Shared/Storages/Add.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Livewire/Project/Shared/Storages/Add.php b/app/Livewire/Project/Shared/Storages/Add.php index 6e250bd90..dc015386c 100644 --- a/app/Livewire/Project/Shared/Storages/Add.php +++ b/app/Livewire/Project/Shared/Storages/Add.php @@ -81,11 +81,18 @@ class Add extends Component 'file_storage_path' => 'string', 'file_storage_content' => 'nullable|string', ]); + $this->file_storage_path = trim($this->file_storage_path); $this->file_storage_path = str($this->file_storage_path)->start('/')->value(); + if ($this->resource->getMorphClass() === \App\Models\Application::class) { $fs_path = application_configuration_dir().'/'.$this->resource->uuid.$this->file_storage_path; + } elseif (str($this->resource->getMorphClass())->contains('Standalone')) { + $fs_path = database_configuration_dir().'/'.$this->resource->uuid.$this->file_storage_path; + } else { + throw new \Exception('No valid resource type for file mount storage type!'); } + LocalFileVolume::create( [ 'fs_path' => $fs_path, @@ -109,10 +116,12 @@ class Add extends Component 'file_storage_directory_source' => 'string', 'file_storage_directory_destination' => 'string', ]); + $this->file_storage_directory_source = trim($this->file_storage_directory_source); $this->file_storage_directory_source = str($this->file_storage_directory_source)->start('/')->value(); $this->file_storage_directory_destination = trim($this->file_storage_directory_destination); $this->file_storage_directory_destination = str($this->file_storage_directory_destination)->start('/')->value(); + LocalFileVolume::create( [ 'fs_path' => $this->file_storage_directory_source,