Skip to content
Snippets Groups Projects
Commit 36f5ecd3 authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Adam G-H
Browse files

Issue #3342726 by kunal.sachdev, Wim Leers: UnknownPathExcluder doesn’t consider hidden files

parent a8533e25
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,8 @@ final class UnknownPathExcluder implements EventSubscriberInterface { ...@@ -64,7 +64,8 @@ final class UnknownPathExcluder implements EventSubscriberInterface {
// @todo Refactor in https://www.drupal.org/project/automatic_updates/issues/3334994. // @todo Refactor in https://www.drupal.org/project/automatic_updates/issues/3334994.
$core_packages = $event->stage->getActiveComposer()->getCorePackages(); $core_packages = $event->stage->getActiveComposer()->getCorePackages();
$scaffold_files_paths = $this->getScaffoldFiles($core_packages); $scaffold_files_paths = $this->getScaffoldFiles($core_packages);
$paths_in_project_root = glob("$project_root/*"); // Search for all files (including hidden ones) in project root.
$paths_in_project_root = glob("$project_root/{,.}*", GLOB_BRACE);
$paths = []; $paths = [];
$known_paths = array_merge([$vendor_dir, $web_root, "$project_root/composer.json", "$project_root/composer.lock"], $scaffold_files_paths); $known_paths = array_merge([$vendor_dir, $web_root, "$project_root/composer.json", "$project_root/composer.lock"], $scaffold_files_paths);
foreach ($paths_in_project_root as $path_in_project_root) { foreach ($paths_in_project_root as $path_in_project_root) {
......
...@@ -94,6 +94,16 @@ class UnknownPathExcluderTest extends PackageManagerKernelTestBase { ...@@ -94,6 +94,16 @@ class UnknownPathExcluderTest extends PackageManagerKernelTestBase {
NULL, NULL,
['unknown_file.txt'], ['unknown_file.txt'],
], ],
'unknown hidden file where web and project root same' => [
FALSE,
NULL,
['.unknown_file'],
],
'unknown hidden file where web and project root different' => [
TRUE,
NULL,
['.unknown_file'],
],
'unknown directory where web and project root same' => [ 'unknown directory where web and project root same' => [
FALSE, FALSE,
'unknown_dir', 'unknown_dir',
...@@ -104,6 +114,16 @@ class UnknownPathExcluderTest extends PackageManagerKernelTestBase { ...@@ -104,6 +114,16 @@ class UnknownPathExcluderTest extends PackageManagerKernelTestBase {
'unknown_dir', 'unknown_dir',
['unknown_dir/unknown_dir.README.md', 'unknown_dir/unknown_file.txt'], ['unknown_dir/unknown_dir.README.md', 'unknown_dir/unknown_file.txt'],
], ],
'unknown hidden directory where web and project root same' => [
FALSE,
'.unknown_dir',
['.unknown_dir/unknown_dir.README.md', '.unknown_dir/unknown_file.txt'],
],
'unknown hidden directory where web and project root different' => [
TRUE,
'.unknown_dir',
['.unknown_dir/unknown_dir.README.md', '.unknown_dir/unknown_file.txt'],
],
]; ];
} }
......
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