Skip to content
This repository was archived by the owner on Jul 18, 2018. It is now read-only.

Commit 5dbd6e2

Browse files
soren121lialan
authored andcommitted
Exclude directory paths from file system search (felixfbecker#401)
* Exclude directories from file system search Directories can also match the glob search pattern if their names end in ".php", which will cause a read error later since the ContentRetriever implementers are expecting files. As far as I know, the only way to fix this is to do an additional check to ensure the URI is not of a directory. This resolves felixfbecker#306.
1 parent 6513922 commit 5dbd6e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/FilesFinder/FileSystemFilesFinder.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public function find(string $glob): Promise
2222
return coroutine(function () use ($glob) {
2323
$uris = [];
2424
foreach (new GlobIterator($glob) as $path) {
25-
$uris[] = pathToUri($path);
25+
// Exclude any directories that also match the glob pattern
26+
if (!is_dir($path)) {
27+
$uris[] = pathToUri($path);
28+
}
29+
2630
yield timeout();
2731
}
2832
return $uris;

0 commit comments

Comments
 (0)