git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv4 1/2] gitweb: make static files accessible with PATH_INFO
@ 2009-01-28 10:50 Giuseppe Bilotta
  2009-01-28 10:50 ` [PATCHv4 2/2] gitweb: webserver config for PATH_INFO Giuseppe Bilotta
  2009-01-31  1:14 ` [PATCHv4 1/2] gitweb: make static files accessible with PATH_INFO Jakub Narebski
  0 siblings, 2 replies; 3+ messages in thread
From: Giuseppe Bilotta @ 2009-01-28 10:50 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Junio C Hamano, Giuseppe Bilotta

When gitweb is invoked with PATH_INFO and links to static files such as
the CSS and favicon/shortcut icon are relative URLs with relative paths
(as is the case when using the default Makefile), these files are not
accessible beyond the project list and summary page (e.g. in shortlog or
commit view).

Fix this by adding a <base> tag pointing to the script's own URL, that
ensure that all relative paths will be based on this.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitweb/gitweb.perl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 931db4f..f7aaf9a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-31  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-28 10:50 [PATCHv4 1/2] gitweb: make static files accessible with PATH_INFO Giuseppe Bilotta
2009-01-28 10:50 ` [PATCHv4 2/2] gitweb: webserver config for PATH_INFO Giuseppe Bilotta
2009-01-31  1:14 ` [PATCHv4 1/2] gitweb: make static files accessible with PATH_INFO Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).