fix: avoid scanning a non existing directory

Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
pull/44203/head
Benjamin Gaussorgues 3 months ago
parent f316edb9ff
commit 5158bbf09b
No known key found for this signature in database
GPG Key ID: 5DAC1CAFAA6DB883

@ -282,7 +282,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));

Loading…
Cancel
Save