]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Fix blob linenr links in pathinfo mode
authorPetr Baudis <redacted>
Fri, 6 Nov 2009 15:08:41 +0000 (16:08 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:39 +0000 (00:50 -0400)
In pathinfo mode, we use <base href> that refers to the base location
of gitweb in order for various external media links to work well.
However, this means that for the page to refer to itself, it must
regenerate full link, and this is exactly what the blob view page
did not do for line numbers.

Signed-off-by: Petr Baudis <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 4cc432382d792983b9f6a2f8bd2b834f0b7bbbce6ab0f0c3009bba76ddb5ef00..ef145859d256885e66e035ff5e869c33baf6aa2c14453435aa9f66fcfa23eec1 100755 (executable)
@@ -5267,7 +5267,8 @@ sub git_blob {
                        chomp $line;
                        $nr++;
                        $line = untabify($line);
-                       printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
+                       printf "<div class=\"pre\"><a id=\"l%i\" href=\"" . href(-replay => 1)
+                               . "#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
                               $nr, $nr, $nr, esc_html($line, -nbsp=>1);
                }
        }
This page took 0.028753 seconds and 4 git commands to generate.