git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Daniel Abrecht <git-git@nodmarc.danielabrecht.ch>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: fix base url set if PATH_INFO is used, add a / at the end.
Date: Mon, 06 Feb 2023 14:02:09 -0800	[thread overview]
Message-ID: <xmqqsffi4fmm.fsf@gitster.g> (raw)
In-Reply-To: <585496b18c853140144c3e7ae13c0124@abrecht.li> (Daniel Abrecht's message of "Fri, 03 Feb 2023 22:42:13 +0100")

Daniel Abrecht <git-git@nodmarc.danielabrecht.ch> writes:

> In HTML, if there is a base tag like `<base href="/a/b">`,
> a relative URL like `c/d` will be resolved by the browser as
> `a/c/d` and not as `a/b/c/d`. But with a base tag like
> `<base href="/a/b/">` it will result in `a/b/c/d`. So by
> adding a slash there, the browser should now search the
> files at the correct location.
>
> Signed-off-by: Daniel Abrecht <public@danielabrecht.ch>
> ---
>  gitweb/gitweb.perl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index e66eb3d9ba..acb2cce5f6 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4217,7 +4217,7 @@ sub git_header_html {
>  	# 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($base_url)."\" />\n";
> +		print "<base href=\"".esc_url($base_url)."/\" />\n";

Doesn't this need to be somewhat conditional?  Sites like repo.or.cz
currently give <base href="/" /> presumably because $base_url for
them is '/', and this change will make them show double slashes
instead of a single one, no?

  reply	other threads:[~2023-02-06 22:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 21:42 [PATCH] gitweb: fix base url set if PATH_INFO is used, add a / at the end Daniel Abrecht
2023-02-06 22:02 ` Junio C Hamano [this message]
2023-02-09 22:26 ` [PATCH v2] " Daniel Abrecht
2023-02-09 23:05   ` Junio C Hamano
2023-02-14 10:15     ` Daniel Abrecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqsffi4fmm.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git-git@nodmarc.danielabrecht.ch \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).