]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix setting images through occ for theming 24232/head
authorJulius Härtl <jus@bitgrid.net>
Thu, 19 Nov 2020 07:28:48 +0000 (08:28 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 19 Nov 2020 22:18:55 +0000 (22:18 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/theming/lib/Command/UpdateConfig.php

index 7d616879dc6340a831e41a1c6812957ba9c908cc..849744077ef42bcc71f6876028536ca675cd0080 100644 (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);