Fix regression and hide disabled default vhost files

This commit is contained in:
Ilia Ross
2026-05-19 23:28:24 +02:00
parent d93fd6a4b6
commit 52d0382619
2 changed files with 12 additions and 1 deletions

View File

@@ -914,7 +914,8 @@ if (&can_manage_vhost_files()) {
my @filevirts = @{$active_by_file{$file} || [ ]};
my $active = @filevirts ? 1 : 0;
if (!@filevirts) {
@filevirts = grep { &can_edit_virt($_) }
@filevirts = grep { &can_edit_virt($_) &&
!&is_default_vhost($_) }
&find_virtuals_in_file($file);
}
foreach my $v (@filevirts) {

View File

@@ -227,6 +227,16 @@ subtest 'same-name symlink to another target is not disabled' => sub {
is(readlink($link), $other, 'preserved symlink target is unchanged');
};
subtest 'disabled default virtual hosts stay hidden' => sub {
my $disabled_default = File::Spec->catfile($available,
'zz-disabled-default.conf');
write_text($disabled_default, vhost_conf(undef, '/srv/disabled-default'));
my @rows = main::get_virtual_list_rows(apache_config());
ok(!(grep { $_->{'file'} eq $disabled_default } @rows),
'disabled catch-all virtual host file is not listed as a normal vhost');
};
subtest 'legacy webfile link helpers resolve relative link_dir' => sub {
my $relative = File::Spec->catfile($available, 'relative.conf');
my $link = File::Spec->catfile($enabled, 'relative.conf');