From 44df29ea185b1a4f72ec8006cf9f7c1e5aa0df45 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 15 Oct 2016 16:01:26 +0200 Subject: [PATCH] Fix 404 on /(pkg|man)/ --- www/index.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/www/index.pl b/www/index.pl index 70e488c..ef17187 100755 --- a/www/index.pl +++ b/www/index.pl @@ -48,6 +48,14 @@ TUWF::register( qr{info/about} => \&about, qr{browse/search} => \&browsesearch, + # These have to go before the other mappings, to ensure that links work for + # man pages called 'pkg' or 'man'. This also means that we can't have a + # system named 8 hex digits, but at least that's easy to guarantee. :) + qr{([^/]+)/([0-9a-f]{8})} => \&man, + qr{([^/]+)/([0-9a-f]{8})/src} => \&src, + # We don't have any other single-component paths + qr{([^/]+)} => \&man, + qr{pkg/([^/]+)} => \&pkg_list, # pkg/$system/$category/$name (/$version); $category may contain a slash, too. qr{pkg/([^/]+)/(.+)} => \&pkg_info, @@ -67,10 +75,6 @@ TUWF::register( $self->resRedirect("/pkg/$sys->{short}/$pkgs->[0]{category}/$name".($ver ? "/$ver" :''), 'perm'); }, - qr{([^/]+)/([0-9a-f]{8})} => \&man, - qr{([^/]+)/([0-9a-f]{8})/src} => \&src, - qr{([^/]+)} => \&man, - # Redirect for a specific language for a man page. # I'm not a fan of this solution; might drop it in the future. qr{lang/([^/]+)/([^/]+)} => sub {