From a195b2a2195a27110df055153105743b80746b36 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 21 Jan 2017 04:41:06 +0000 Subject: repobrowse: fix full URL generation in Atom feed We must not drop the leading slash in the URI. This regression was introduced when we dropped Plack::Request dependency. --- lib/PublicInbox/RepobrowseGitAtom.pm | 1 - t/repobrowse_git_atom.t | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/RepobrowseGitAtom.pm b/lib/PublicInbox/RepobrowseGitAtom.pm index f851ee36..c542281c 100644 --- a/lib/PublicInbox/RepobrowseGitAtom.pm +++ b/lib/PublicInbox/RepobrowseGitAtom.pm @@ -22,7 +22,6 @@ sub repo_root_url { my $uri = $env->{REQUEST_URI}; $uri =~ s/\?.+\z//; # no query string my @uri = split(m!/+!, $uri); - shift @uri; # leading slash my @extra = @{$req->{extra}}; while (@uri && @extra && $uri[-1] eq $extra[-1]) { pop @uri; diff --git a/t/repobrowse_git_atom.t b/t/repobrowse_git_atom.t index 2525effd..4f0078eb 100644 --- a/t/repobrowse_git_atom.t +++ b/t/repobrowse_git_atom.t @@ -28,6 +28,7 @@ test_psgi($test->{app}, sub { $res = $cb->(GET($req . '/foo.txt')); is($res->code, 200, 'got 200'); $body = dechunk($res); + like($body, qr{\bhref="http://[^/]+/test\.git/}, 'hrefs OK'); SKIP: { skip 'XML::Feed missing', 2 unless $have_xml_feed; my $p = XML::Feed->parse(\$body); -- cgit v1.2.3-24-ge0c7