Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent hidden folders in volumes from being indexed #11384

Merged
merged 3 commits into from
Jun 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/services/AssetIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ class AssetIndexer extends Component
* @param Volume $volume The Volume to perform indexing on.
* @param string $directory Optional path to get index list on a subfolder.
* @return Generator
* @throws FsException
*/
public function getIndexListOnVolume(Volume $volume, string $directory = ''): Generator
{
try {
$fileList = $volume->getFs()->getFileList($directory);
} catch (VolumeException $exception) {
} catch (InvalidConfigException|FsException $exception) {
Craft::$app->getErrorHandler()->logException($exception);
return;
}
Expand Down Expand Up @@ -165,13 +164,7 @@ public function startIndexingSession(array $volumes, bool $cacheRemoteImages = t

/** @var Volume $volume */
foreach ($volumeList as $volume) {
try {
$fileList = $volume->getFs()->getFileList();
} catch (FsException) {
Craft::warning('Unable to list files in ' . $volume->handle . '.');
continue;
}

$fileList = $this->getIndexListOnVolume($volume);
$total += $this->storeIndexList($fileList, $session->id, (int)$volume->id);
}

Expand Down