Skip to content

Commit 937b746

Browse files
authored
Merge pull request #44203 from nextcloud/fix/scandir-nx-directory
fix: avoid scanning a non existing directory
2 parents 277a7b9 + 5158bbf commit 937b746

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/private/Files/Storage/Local.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@ public function isUpdatable($path) {
282282
public function file_exists($path) {
283283
if ($this->caseInsensitive) {
284284
$fullPath = $this->getSourcePath($path);
285-
$content = scandir(dirname($fullPath), SCANDIR_SORT_NONE);
285+
$parentPath = dirname($fullPath);
286+
if (!is_dir($parentPath)) {
287+
return false;
288+
}
289+
$content = scandir($parentPath, SCANDIR_SORT_NONE);
286290
return is_array($content) && array_search(basename($fullPath), $content) !== false;
287291
} else {
288292
return file_exists($this->getSourcePath($path));

0 commit comments

Comments
 (0)