fix: non-ascii chars in labels

This commit is contained in:
Andras Bacsai 2023-12-12 16:34:05 +01:00
parent f042c70b3c
commit f68aace445

View File

@ -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) {