Skip to content

Commit

Permalink
gitweb: make static files accessible with PATH_INFO
Browse files Browse the repository at this point in the history
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 <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Giuseppe Bilotta authored and Junio C Hamano committed Jan 31, 2009
1 parent 499cc56 commit c3254ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2901,6 +2901,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
Expand Down

0 comments on commit c3254ae

Please sign in to comment.