Backend: an existing folder that cannot be listed is an error, not empty
Read as empty, a catalog/ or index/ folder would make an existing repository look new.
This commit is contained in:
@@ -114,7 +114,10 @@ final class LocalBackend implements IBackend {
|
||||
}
|
||||
$result = [];
|
||||
$names = scandir($base);
|
||||
foreach ($names === false ? [] : $names as $name) {
|
||||
if ($names === false) {
|
||||
throw new BackendException('Cannot list ' . $dir);
|
||||
}
|
||||
foreach ($names as $name) {
|
||||
if ($name !== '.' && $name !== '..' && !StorageBackend::isTemporary($name)) {
|
||||
$result[] = trim($dir, '/') . '/' . $name;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,8 @@ final class StorageBackend implements IBackend {
|
||||
}
|
||||
$dh = $this->storage->opendir($abs);
|
||||
if ($dh === false) {
|
||||
return [];
|
||||
// An existing folder read as empty would look like a new repository.
|
||||
throw new BackendException('Cannot list ' . $dir);
|
||||
}
|
||||
$cut = $this->base === '' ? 0 : strlen($this->base) + 1;
|
||||
$result = [];
|
||||
|
||||
Reference in New Issue
Block a user