]> git.proxmox.com Git - pve-manager.git/commitdiff
report: dir2text: ignore special . and .. files
authorAaron Lauterer <a.lauterer@proxmox.com>
Tue, 3 Oct 2023 11:36:37 +0000 (13:36 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 2 Nov 2023 19:59:59 +0000 (20:59 +0100)
So far this hasn't been an issue as each user of dir2text wanted files
with a specific pattern. But if we want every file in the directory, we
need to skip the special files '.' and '..'.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
PVE/Report.pm

index c9109dcaca09d9a359ac46e9baca500a0045d07b..435458b99dcf5ae32d002099e5baa82c5eea3d58 100644 (file)
@@ -13,6 +13,7 @@ my sub dir2text {
     my $text = '';
     PVE::Tools::dir_glob_foreach($target_dir, $regexp, sub {
        my ($file) = @_;
+       return if $file eq '.' || $file eq '..';
        $text .=  "\n# cat $target_dir$file\n";
        $text .= PVE::Tools::file_get_contents($target_dir.$file)."\n";
     });