From 962a7c848a30f47679d58f55eae6a3da39a89300 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 29 Apr 2024 11:31:26 +0200 Subject: [PATCH] www: Fix search redirect if no section is specified i.e. let the man_pref logic determine the most useful section, instead of forcing the first relevant section in the redirect. --- www/index.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/index.pl b/www/index.pl index 095f2c7..9cf2a06 100755 --- a/www/index.pl +++ b/www/index.pl @@ -602,7 +602,7 @@ TUWF::get '/browse/search' => sub { # Redirect if we have an exact match my @sectsql = length $sect ? ('AND section =', \$sect) : (); my $man = length $name && tuwf->dbRowi('SELECT name, section FROM mans WHERE name =', \$name, @sectsql); - return tuwf->resRedirect("/man/$man->{name}.$man->{section}", 'temp') if length $man->{name}; + return tuwf->resRedirect("/man/$man->{name}".(length $sect ? ".$man->{section}" : ''), 'temp') if length $man->{name}; # Otherwise, do case-insensitive glob search my $nameq = escape_like(lc $name) =~ tr/?*/_%/r;