public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob 8675d0d7d0fad981c93fe2a9a3e69607298c03d5 652 bytes (raw)
$ git show repobrowse:lib/PublicInbox/RepoGitFallback.pm	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
# Copyright (C) 2015 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ (https://www.gnu.org/licenses/agpl-3.0.txt)

# when no endpoints match, fallback to this and serve a static file
# This can serve Smart HTTP in the future.
package PublicInbox::RepoGitFallback;
use strict;
use warnings;
use base qw(PublicInbox::RepoBase);
use PublicInbox::GitHTTPBackend;

# overrides PublicInbox::RepoBase::call
sub call {
	my ($self, undef, $req) = @_;
	my $expath = $req->{expath};
	return if index($expath, '..') >= 0; # prevent path traversal
	my $git = $req->{-repo}->{git};
	PublicInbox::GitHTTPBackend::serve($req->{env}, $git, $expath);
}

1;

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git