From 17d6171d95142aba39dfe9da4e21faf7fe48342f Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 13 Dec 2023 00:36:50 +0200 Subject: [PATCH] fix directory existion check #2 --- src/webui/explore.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/webui/explore.php b/src/webui/explore.php index 997aecc..65de024 100644 --- a/src/webui/explore.php +++ b/src/webui/explore.php @@ -89,19 +89,23 @@ $filepath = implode( /// Local snaps if ($config->snap->storage->local->enabled) { - /// absolute - if ('/' === substr($config->snap->storage->local->directory, 0, 1)) - { - $prefix = $config->snap->storage->local->directory; - } + /// absolute + if ('/' === substr($config->snap->storage->local->directory, 0, 1)) + { + $prefix = $config->snap->storage->local->directory; + } - /// relative - else - { - $prefix = __DIR__ . '/../../' . $config->snap->storage->local->directory; - } + /// relative + else + { + $prefix = __DIR__ . '/../../' . $config->snap->storage->local->directory; + } + + $directory = sprintf('%s/%s', $prefix, $filepath); - foreach ((array) scandir(sprintf('%s/%s', $prefix, $filepath)) as $filename) + if (is_dir($directory)) + { + foreach ((array) scandir($directory) as $filename) { if (in_array($filename, ['.', '..'])) { @@ -126,6 +130,7 @@ if ($config->snap->storage->local->enabled) ), ]; } + } } /// Remote snaps