From 9b7bdfef79c84c8899fad4837a71825dcf9c84e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 19 Nov 2020 08:28:48 +0100 Subject: [PATCH] Fix setting images through occ for theming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/theming/lib/Command/UpdateConfig.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/theming/lib/Command/UpdateConfig.php b/apps/theming/lib/Command/UpdateConfig.php index 7d616879dc..849744077e 100644 --- a/apps/theming/lib/Command/UpdateConfig.php +++ b/apps/theming/lib/Command/UpdateConfig.php @@ -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('Invalid config key provided'); 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('The image file needs to be provided as an absolute path: ' . $value . '.'); + return 1; } if (!file_exists($value)) { - $output->writeln('File could not be found: ' . $value . ''); + $output->writeln('File could not be found: ' . $value . '.'); return 1; } $value = $this->imageManager->updateImage($key, $value);