From 8d1732ed02b59554f3a71055b4b8a210ebcd3726 Mon Sep 17 00:00:00 2001 From: Nicholas Narsing Date: Sun, 11 Jun 2017 17:24:17 -0400 Subject: [PATCH] Exclude directory paths from file system search (#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 #306. --- src/FilesFinder/FileSystemFilesFinder.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/FilesFinder/FileSystemFilesFinder.php b/src/FilesFinder/FileSystemFilesFinder.php index 52df4b6..a26b5d8 100644 --- a/src/FilesFinder/FileSystemFilesFinder.php +++ b/src/FilesFinder/FileSystemFilesFinder.php @@ -22,7 +22,11 @@ class FileSystemFilesFinder implements FilesFinder return coroutine(function () use ($glob) { $uris = []; foreach (new GlobIterator($glob) as $path) { - $uris[] = pathToUri($path); + // Exclude any directories that also match the glob pattern + if (!is_dir($path)) { + $uris[] = pathToUri($path); + } + yield timeout(); } return $uris;