gitweb: make static files accessible with PATH_INFO
PATCH v4 1/1 gitweb: make static files accessible with PATH_INFO
When PATH_INFO is defined, static files such as the default CSS or the shortcut icon are not accessible beyond the summary page (e.g. in shortlog or commit view).
Fix this by adding a <base> tag pointing to the script's own URL.
--- gitweb/gitweb.perl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
gitweb/gitweb.perl +5 -0
@@ -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=\"$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
Signature · 1 line
1.5.6.5
Quoted 16 lines · Giuseppe Bilotta
When
PATH_INFOis defined, static files such as the default CSS or the shortcut icon are not accessible beyond the summary page (e.g. in shortlog or commit view).Fix this by adding a <base> tag pointing to the script's own URL.
Signed-off-by Giuseppe Bilotta <[email protected]>--- gitweb/gitweb.perl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)gitweb/gitweb.perl +0
-0
gitweb/gitweb.perl sub git_header_html { · line 2908
Quoted 8 lines
gitweb/gitweb.perl +5
-0@@ -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=\"$my_url\" />\n"; + }
Perhaps this is a stupid question, but is $my_url already safe to include in the output without any further quoting at this point in the codepath?
Quoted 3 lines · Junio C Hamano
Quoted 1 line · Giuseppe Bilotta
When
PATH_INFOis defined,
I other words: when using PATH_INFO gitweb URL
Quoted 3 lines
Quoted 3 lines
static files such as the default CSS or the
shortcut icon are not accessible beyond the summary page (e.g. in shortlog or commit view).
To be more exact: if static files, such as the default CSS (and also other stylesheets, if defined), the gitweb favicon / shortcut icon, or the gitweb logo locations (URIs) are defined using relative URL with relative path (and default Makefile rule to generate gitweb.cgi uses basenames like 'gitweb.css', which are relative paths) _THEN_ those static files are not accessible beyond 'summary' and projects list view (e.g. in 'shortlog' or 'commit' view).
Quoted 2 lines
Quoted 2 lines
Fix this by adding a <base> tag pointing to the script's own URL.
Which defines base URL for all relative links in gitweb.
/Note that this makes the document hierarchy non-portable, but I don't think we care.../
Quoted 6 lines
Quoted 6 lines
Signed-off-by Giuseppe Bilotta <[email protected]>--- gitweb/gitweb.perl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Quoted 10 lines
gitweb/gitweb.perl sub git_header_html { · line 2905
Quoted 10 lines
gitweb/gitweb.perl +2
-0@@ -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
+# the stylesheet, favicon, etc URLs won't work correctly with path_info, +# unless we set the appropriate base URL
By the way, I think those comments should be indented aligned to accompanying code, but this is issue of separate whitespace cleanup, independent of the issue this commit tries to solve.
Quoted 6 lines
gitweb/gitweb.perl sub git_header_html { · line 2908
Quoted 3 lines
gitweb/gitweb.perl +3
-0+ if ($ENV{'PATH_INFO'}) { + print "<base href=\"$my_url\" />\n"; + }Perhaps this is a stupid question, but is $my_url already safe to include in the output without any further quoting at this point in the codepath?
Hmmmm... to be safe we probably should use either esc_url($my_url) here (like in git_feed subroutine).
Signature · 2 lines
Jakub Narebski Poland
Quoted 6 lines · Jakub Narebski
Quoted 3 lines · Junio C Hamano
Quoted 1 line · Giuseppe Bilotta
When
PATH_INFOis defined,I other words: when using
PATH_INFOgitweb URL
Notice that gitweb accepts PATH_INFO even whe it's not set to produce them
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
static files such as the default CSS or the
shortcut icon are not accessible beyond the summary page (e.g. in shortlog or commit view).To be more exact: if static files, such as the default CSS (and also other stylesheets, if defined), the gitweb favicon / shortcut icon, or the gitweb logo locations (URIs) are defined using relative URL with relative path (and default
Makefilerule to generate gitweb.cgi uses basenames like 'gitweb.css', which are relative paths) _THEN_ those static files are not accessible beyond 'summary' and projects list view (e.g. in 'shortlog' or 'commit' view).
I'll rewrite the commit message.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Fix this by adding a <base> tag pointing to the script's own URL.
Which defines base URL for all relative links in gitweb.
(is this one really necessary)
Quoted 2 lines
/Note that this makes the document hierarchy non-portable, but I don't think we care.../
In what sense it becomes non-portable?
Quoted 9 lines
Quoted 6 lines
gitweb/gitweb.perl sub git_header_html { · line 2908
Quoted 3 lines
gitweb/gitweb.perl +3
-0+ if ($ENV{'PATH_INFO'}) { + print "<base href=\"$my_url\" />\n"; + }Perhaps this is a stupid question, but is $my_url already safe to include in the output without any further quoting at this point in the codepath?
Hmmmm... to be safe we probably should use either
esc_url($my_url)here (like ingit_feedsubroutine).
I"ll do that.
Signature · 1 line
Giuseppe "Oblomov" Bilotta