[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    [PATCH 6/6] gitweb: prevent double slashes in PATH_INFO hrefs
From:       Giuseppe Bilotta <giuseppe.bilotta () gmail ! com>
Date:       2008-09-21 20:57:43
Message-ID: 1222030663-22540-7-git-send-email-giuseppe.bilotta () gmail ! com
[Download RAW message or body]

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.

Fix by removing the trailing slash (if present) from $href before
appending PATH_INFO data.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic