Re: [PATCH 6/6] gitweb: prevent double slashes in PATH_INFO hrefs
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Sep 29, 2008, 18:12 UTC
- Message-ID
- <200809292012.09460.jnareb@gmail.com>
- In-Reply-To
- <1222030663-22540-7-git-send-email-giuseppe.bilotta@gmail.com>
On Sun, 21 Sep 2008, Giuseppe Bilotta wrote:
> When using PATH_INFO in combination with a rewrite rule that hides the > cgi script name, links to projects and/or actions without projects might > be generated with a double slash. >
You mean here that base URL ends with '/'?
> Fix by removing the trailing slash (if present) from $href before > appending PATH_INFO data. > > Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
This is a good change, and worth applying even before the rest of series (which probably would go through a few rounds of review). I'm not sure if it applies cleanly, but conceptually it does not depend on the rest of patches in this series.
Show 21 quoted lines
> ---
> gitweb/gitweb.perl | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 4a91d07..ebab86b 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -675,6 +675,8 @@ sub href (%) {
>
> my ($use_pathinfo) = gitweb_check_feature('pathinfo');
> if ($use_pathinfo) {
> + $href =~ s,/$,,;
> +
> # use PATH_INFO for project name
> $href .= "/".esc_url($params{'project'}) if defined $params{'project'};
> delete $params{'project'};
> --
> 1.5.6.5
>
> Should not go wrong...
-- Jakub Narebski Poland