diff --git a/www/index.pl b/www/index.pl index 8ddc37f..8219bd9 100755 --- a/www/index.pl +++ b/www/index.pl @@ -181,13 +181,17 @@ sub man_pref { sub man_pref_name { my($name, $where) = @_; - my $man = man_pref undef, sql_and $where, sql 'm.name =', \$name; - return ($man, '') if length $man->{name}; + # Check the .
format first, because ~most~ cases where + # there's a collision in the format, the -only page is either + # uninteresting or a file name parsing error. + if ($name =~ /^(.+)\.([^.]+)$/) { + my($n, $s) = ($1,$2); + my $man = man_pref $s, sql_and $where, sql 'm.name =', \$n; + return ($man, $s) if length $man->{name}; + } - return (undef, '') if $name !~ s/\.([^.]+)$// || !length $name; - my $section = $1; - $man = man_pref $section, sql_and $where, sql 'm.name =', \$name; - length $man->{name} ? ($man, $section) : (undef, ''); + my $man = man_pref undef, sql_and $where, sql 'm.name =', \$name; + length $man->{name} ? ($man, '') : (undef, ''); }