mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
Validate the theming color also on CLI
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
00edbc2adf
commit
080e26fb80
2 changed files with 10 additions and 1 deletions
|
|
@ -127,6 +127,11 @@ class UpdateConfig extends Command {
|
|||
$key = $key . 'Mime';
|
||||
}
|
||||
|
||||
if ($key === 'color' && !preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) {
|
||||
$output->writeln('<error>The given color is invalid: ' . $value . '</error>');
|
||||
return 1;
|
||||
}
|
||||
|
||||
$this->themingDefaults->set($key, $value);
|
||||
$output->writeln('<info>Updated ' . $key . ' to ' . $value . '</info>');
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,11 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue