Fix /man/* redirects

Forgot to update these functions in the rewrite.
This commit is contained in:
Yorhel 2021-06-09 16:56:41 +02:00
parent 98e4f014ba
commit a96aeb6310

View file

@ -717,7 +717,7 @@ TUWF::get qr{/(?<name>[^/]+)(?:/(?<hash>[0-9a-f]{8}))?} => sub {
# Unfortunately, even in the permalink format with the hash, we don't know
# from which package we're supposed to get the man page. This info is
# needed in order to do .so substitution, so we can substitute files from
# the same package as the requested man page. Use the dbManPref logic here
# the same package as the requested man page. Use the man_pref logic here
# to deterministically select a good package.
my($man, undef) = $shorthash
? man_pref undef, sql 'm.name =', \$name, 'AND', sql_hash_prefix 'm.hash', $shorthash
@ -897,19 +897,16 @@ TUWF::get qr{/man/([^/]+)/(.+)} => sub {
my $man;
if($path !~ m{/}) { # (1)
($man) = tuwf->dbManPrefName($path, sysid => $sysid);
($man) = man_pref_name $path, sql 's.id IN', $sysid;
} else {
$path =~ s{/([^/]+)$}{};
my $name = $1;
my($pkg, $ver) = pkg_frompath(sql('system IN', $sysid), $path); # Handles (2) and (3)
my($pkg, $ver) = pkg_frompath sql('system IN', $sysid), $path; # Handles (2) and (3)
return tuwf->resNotFound if !$pkg;
my $verid = tuwf->dbVali('SELECT id FROM package_versions WHERE package =', \$pkg->{id}, 'AND version =', \$ver);
return tuwf->resNotFound if $ver && !$verid;
($man) = tuwf->dbManPrefName($name, sysid => $sysid, pkgid => $pkg->{id}, pkgver => $verid);
($man) = man_pref_name $name, sql 's.id IN', $sysid, 'AND p.id =', \$pkg->{id}, $ver ? ('AND v.version =', \$ver) : ();
}
return tuwf->resNotFound if !$man;