]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: make static files accessible with PATH_INFO
authorGiuseppe Bilotta <redacted>
Sat, 31 Jan 2009 01:31:50 +0000 (02:31 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:38 +0000 (00:50 -0400)
Gitweb links to a number of static files such as CSS stylesheets,
favicon or the git logo. When, such as with the default Makefile, the
paths to these files are relative (i.e. doesn't start with a "/"), the
files become inaccessible in any view other tha project list and summary
page if gitweb is invoked with a non-empty PATH_INFO.

Fix this by adding a <base> element pointing to the script's own URL,
which ensure that all relative paths will be resolved correctly.

Signed-off-by: Giuseppe Bilotta <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 409346b57881981f58be4be67c2a931ec6bfdbb976aa4e1897b9818ad64fad23..a0b1681acaf23200cf0835ca08c29be0c7eab7cc66e01671a56281e726cba017 100755 (executable)
@@ -2902,6 +2902,11 @@ sub git_header_html {
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 EOF
+# the stylesheet, favicon etc urls won't work correctly with path_info unless we
+# set the appropriate base URL
+       if ($ENV{'PATH_INFO'}) {
+               print '<base href="'.esc_url($my_url).'" />\n';
+       }
 # print out each stylesheet that exist
        if (defined $stylesheet) {
 #provides backwards capability for those people who define style sheet in a config file
This page took 0.195243 seconds and 4 git commands to generate.