git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv4] gitweb: make static files accessible with PATH_INFO

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 28, 2009, 01:07 UTC
Message-ID
<7vocxsz19e.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1233103932-6325-1-git-send-email-giuseppe.bilotta@gmail.com>
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
Show 24 quoted lines
> 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.
>
> 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..55e3081 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=\"$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?

Previous: Giuseppe BilottaNext: Jakub Narebski
Message 2 of 4 in “[PATCHv4] gitweb: make static files accessible with PATH_INFO”
  1. Giuseppe BilottaJan 28, 2009
  2. Junio C HamanoJan 28, 2009
  3. Jakub NarebskiJan 28, 2009
  4. Giuseppe BilottaJan 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.