From 52d03826191fcd1512a7f6e007cc91f6af844b24 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Tue, 19 May 2026 23:28:24 +0200 Subject: [PATCH] Fix regression and hide disabled default vhost files --- apache/apache-lib.pl | 3 ++- apache/t/vhost-files.t | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apache/apache-lib.pl b/apache/apache-lib.pl index d407c063d..01a6aabb5 100755 --- a/apache/apache-lib.pl +++ b/apache/apache-lib.pl @@ -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) { diff --git a/apache/t/vhost-files.t b/apache/t/vhost-files.t index a5f04eedf..012c49fe2 100644 --- a/apache/t/vhost-files.t +++ b/apache/t/vhost-files.t @@ -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');