From 63e5b6fb95488aa282fa2d7a430ad60154dbb858 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Thu, 14 Mar 2024 16:26:52 +0100 Subject: fix: avoid scanning a non existing directory Signed-off-by: Benjamin Gaussorgues --- lib/private/Files/Storage/Local.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 813e5aa09d7..661ae68d44e 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -275,7 +275,11 @@ class Local extends \OC\Files\Storage\Common { public function file_exists($path) { if ($this->caseInsensitive) { $fullPath = $this->getSourcePath($path); - $content = scandir(dirname($fullPath), SCANDIR_SORT_NONE); + $parentPath = dirname($fullPath); + if (!is_dir($parentPath)) { + return false; + } + $content = scandir($parentPath, SCANDIR_SORT_NONE); return is_array($content) && array_search(basename($fullPath), $content) !== false; } else { return file_exists($this->getSourcePath($path)); -- cgit v1.2.3