Merge pull request #24211 from nextcloud/bugfix/noid/theming-image

Fix setting images through occ for theming
This commit is contained in:
Morris Jobke 2020-11-19 23:16:42 +01:00 committed by GitHub
commit 568762a5a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -94,7 +94,7 @@ class UpdateConfig extends Command {
return 0;
}
if (!in_array($key, self::SUPPORTED_KEYS, true)) {
if (!in_array($key, self::SUPPORTED_KEYS, true) && !in_array($key, self::SUPPORTED_IMAGE_KEYS, true)) {
$output->writeln('<error>Invalid config key provided</error>');
return 1;
}
@ -116,11 +116,12 @@ class UpdateConfig extends Command {
}
if (in_array($key, self::SUPPORTED_IMAGE_KEYS, true)) {
if (file_exists(__DIR__ . $value)) {
$value = __DIR__ . $value;
if (strpos($value, '/') !== 0) {
$output->writeln('<error>The image file needs to be provided as an absolute path: ' . $value . '.</error>');
return 1;
}
if (!file_exists($value)) {
$output->writeln('<error>File could not be found: ' . $value . '</error>');
$output->writeln('<error>File could not be found: ' . $value . '.</error>');
return 1;
}
$value = $this->imageManager->updateImage($key, $value);