From 078f637c80cc33c7d29973b95fdc16205ad7bb32 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 1 Jan 2020 10:38:59 +0000 Subject: wwwstatic: add directory listing + index.html support It's now possible to use WwwStatic as a standalone PSGI app to serve static files and recreate the award-winning web design of https://public-inbox.org/ :> --- lib/PublicInbox/Cgit.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/Cgit.pm') diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm index c0b1a73b..c42f8847 100644 --- a/lib/PublicInbox/Cgit.pm +++ b/lib/PublicInbox/Cgit.pm @@ -16,7 +16,6 @@ use PublicInbox::Git; use warnings; use PublicInbox::Qspawn; use PublicInbox::WwwStatic qw(r); -use Plack::MIME; sub locate_cgit ($) { my ($pi_config) = @_; @@ -114,9 +113,8 @@ sub call { } } elsif ($path_info =~ m!$self->{static}! && defined($cgit_data = $self->{cgit_data})) { - my $f = $1; - return PublicInbox::WwwStatic::response($env, [], $cgit_data.$f, - Plack::MIME->mime_type($f)); + my $f = $cgit_data.$1; # {static} only matches leading slash + return PublicInbox::WwwStatic::response($env, [], $f); } my $cgi_env = { PATH_INFO => $path_info }; -- cgit v1.2.3-24-ge0c7