From 86823a7e8c0b3a6d94db82f429e95278ece3bed5 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 28 Jul 2016 11:11:34 +0200 Subject: [PATCH] make is-directory check more robust, by checking for PHP's directory-mode / Sqlfs::DIR_MODE too, not only for mime-type which is set eg. by stylite.links to "egs/$app" --- api/src/Vfs/Sqlfs/StreamWrapper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/Vfs/Sqlfs/StreamWrapper.php b/api/src/Vfs/Sqlfs/StreamWrapper.php index 3e3ba79b08..6a73f529fc 100644 --- a/api/src/Vfs/Sqlfs/StreamWrapper.php +++ b/api/src/Vfs/Sqlfs/StreamWrapper.php @@ -1066,11 +1066,12 @@ class StreamWrapper extends Api\Db\Pdo implements Vfs\StreamWrapperIface $path = Vfs::parse_url($url,PHP_URL_PATH); if (!($stat = $this->url_stat($url,0)) || // dir not found - $stat['mime'] != self::DIR_MIME_TYPE || // no dir + !($stat['mode'] & self::MODE_DIR) && $stat['mime'] != self::DIR_MIME_TYPE || // no dir !Vfs::check_access($url,Vfs::EXECUTABLE|Vfs::READABLE,$stat)) // no access { self::_remove_password($url); - $msg = $stat['mime'] != self::DIR_MIME_TYPE ? "$url is no directory" : 'permission denied'; + $msg = !($stat['mode'] & self::MODE_DIR) && $stat['mime'] != self::DIR_MIME_TYPE ? + "$url is no directory" : 'permission denied'; if (self::LOG_LEVEL) error_log(__METHOD__."('$url',$options) $msg!"); $this->opened_dir = null; return false;