]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www_coderepo: fix snapshot link generation
authorEric Wong <e@80x24.org>
Sat, 28 Jan 2023 11:02:51 +0000 (11:02 +0000)
committerEric Wong <e@80x24.org>
Sat, 28 Jan 2023 18:52:32 +0000 (18:52 +0000)
Do not assume ".git" exists as a suffix in the repo nickname,
and filter out all trailing slashes in case it didn't get
filtered from Config.

lib/PublicInbox/WwwCoderepo.pm

index e3d45c564da47561e013ca1b445e7a9ac1a43d72..4d8713b41cdbdfd6e8134b8dc4b22df29888548c 100644 (file)
@@ -142,9 +142,9 @@ EOM
        my $n;
        if (@s) {
                $n = $ctx->{git}->local_nick // die "BUG: $ctx->{git_dir} nick";
-               $n =~ s/\.git\z/-/;
-               ($n) = ($n =~ m!([^/]+)\z!);
-               $n = ascii_html($n);
+               $n =~ s!\.git/*\z!!;
+               ($n) = ($n =~ m!([^/]+)/*\z!);
+               $n = ascii_html($n).'-';
        }
        for (@r) {
                my (undef, $oid, $ref, $s, $cd) = split(/\0/);