]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: fix full URL generation in Atom feed
authorEric Wong <e@80x24.org>
Sat, 21 Jan 2017 04:41:06 +0000 (04:41 +0000)
committerEric Wong <e@80x24.org>
Sat, 21 Jan 2017 04:41:06 +0000 (04:41 +0000)
We must not drop the leading slash in the URI.  This
regression was introduced when we dropped Plack::Request
dependency.

lib/PublicInbox/RepobrowseGitAtom.pm
t/repobrowse_git_atom.t

index f851ee369268118cd9ad908105f2c4ffb479b931..c542281c02c9533f53efadd5aeab37ae2ce24368 100644 (file)
@@ -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;
index 2525effdadf2c43ed18e105d9c336cdd0d47ba55..4f0078ebbd498479f762c0325661e650ae5aa658 100644 (file)
@@ -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);