From f68aace4450103da00adb69852e17207e59132bd Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 12 Dec 2023 16:34:05 +0100 Subject: [PATCH] fix: non-ascii chars in labels --- app/Livewire/Project/Application/General.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index e6cad2eee..a6d82c8ef 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -120,6 +120,11 @@ class General extends Component $this->application->save(); } $this->customLabels = base64_decode(data_get($this->application, 'custom_labels')); + // Fix for non-ascii characters + if (preg_match('~[^\x20-\x7E\t\r\n]~', $this->customLabels) > 0) { + ray('custom_labels contains non-ascii characters'); + $this->resetDefaultLabels(false); + } } $this->initialDockerComposeLocation = $this->application->docker_compose_location; @@ -244,9 +249,7 @@ class General extends Component $this->application->docker_compose_domains = json_encode($this->parsedServiceDomains); $this->parsedServices = $this->application->parseCompose(); } - if ($this->customLabels) { - $this->application->custom_labels = base64_encode($this->customLabels); - } + $this->application->custom_labels = base64_encode($this->customLabels); $this->application->save(); $showToaster && $this->dispatch('success', 'Application settings updated!'); } catch (\Throwable $e) {