Skip to content
Snippets Groups Projects
Commit b0c868c0 authored by fiasco's avatar fiasco Committed by MegaChriz
Browse files

Issue #2309471 by Josh Waihi: File Fetcher doesn't obey allowed extensions

parent 5d838958
No related branches found
No related tags found
No related merge requests found
...@@ -79,15 +79,15 @@ class FeedsFileFetcher extends FeedsFetcher { ...@@ -79,15 +79,15 @@ class FeedsFileFetcher extends FeedsFetcher {
* no files could be found. Never contains directories. * no files could be found. Never contains directories.
*/ */
protected function listFiles($dir) { protected function listFiles($dir) {
$dir = file_stream_wrapper_uri_normalize($dir); // Seperate out string into array of extensions. Make sure its regex safe.
$config = $this->getConfig();
$extensions = array_filter(array_map('preg_quote', explode(' ', $config['allowed_extensions'])));
$regex = '/\.(' . implode('|', $extensions) . ')$/';
$files = array(); $files = array();
if ($items = @scandir($dir)) { foreach (file_scan_directory($dir, $regex) as $file) {
foreach ($items as $item) { $files[] = $file->uri;
if (is_file("$dir/$item") && strpos($item, '.') !== 0) {
$files[] = "$dir/$item";
}
}
} }
return $files; return $files;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment