diff --git a/apps/theming/lib/Command/UpdateConfig.php b/apps/theming/lib/Command/UpdateConfig.php index 3d5840fadd95a..1ff75b5ba700b 100644 --- a/apps/theming/lib/Command/UpdateConfig.php +++ b/apps/theming/lib/Command/UpdateConfig.php @@ -127,6 +127,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int $key = $key . 'Mime'; } + if ($key === 'color' && !preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) { + $output->writeln('The given color is invalid: ' . $value . ''); + return 1; + } + $this->themingDefaults->set($key, $value); $output->writeln('Updated ' . $key . ' to ' . $value . ''); diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 7e7d9a4fa136f..c2ed6e305eb69 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -220,7 +220,11 @@ public function getShortFooter() { * @return string */ public function getColorPrimary() { - return $this->config->getAppValue('theming', 'color', $this->color); + $color = $this->config->getAppValue('theming', 'color', $this->color); + if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) { + $color = '#0082c9'; + } + return $color; } /**