git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: Remove extra "/" in path names for git_get_project_list
@ 2006-11-03  5:11 Aneesh Kumar K.V
  2006-11-03  5:59 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Aneesh Kumar K.V @ 2006-11-03  5:11 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 0001-gitweb-Remove-extra-in-path-names-for-git_get_project_list.txt --]
[-- Type: text/plain, Size: 745 bytes --]


Without this change we get a wrong $pfxlen value and the check_export_ok()
checks with with a wrong directory name. Without this patch the below
$projects_list fails with gitweb

$projects_list = "/tmp/a/b/";

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
 gitweb/gitweb.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7710cc2..a0a9aaf 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -897,6 +897,8 @@ sub git_get_projects_list {
 	if (-d $projects_list) {
 		# search in directory
 		my $dir = $projects_list;
+		# remove the trailing "/"
+		$dir =~ s!/+$!!;
 		my $pfxlen = length("$dir");
 
 		File::Find::find({
-- 
1.4.3.3.gc954-dirty


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gitweb: Remove extra "/" in path names for git_get_project_list
  2006-11-03  5:11 [PATCH] gitweb: Remove extra "/" in path names for git_get_project_list Aneesh Kumar K.V
@ 2006-11-03  5:59 ` Junio C Hamano
  2006-11-03 11:18   ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-11-03  5:59 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: git

"Aneesh Kumar K.V" <aneesh.kumar@gmail.com> writes:

> Without this change we get a wrong $pfxlen value and the check_export_ok()
> checks with with a wrong directory name. Without this patch the below
> $projects_list fails with gitweb
>
> $projects_list = "/tmp/a/b/";
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

Hmph.  Doesn't this break $projects_list = "/", I wonder?

> +		# remove the trailing "/"
> +		$dir =~ s!/+$!!;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gitweb: Remove extra "/" in path names for git_get_project_list
  2006-11-03  5:59 ` Junio C Hamano
@ 2006-11-03 11:18   ` Jakub Narebski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-11-03 11:18 UTC (permalink / raw)
  To: git

Junio C Hamano wrote:

> "Aneesh Kumar K.V" <aneesh.kumar@gmail.com> writes:
> 
>> Without this change we get a wrong $pfxlen value and the check_export_ok()
>> checks with with a wrong directory name. Without this patch the below
>> $projects_list fails with gitweb
>>
>> $projects_list = "/tmp/a/b/";
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
> 
> Hmph.  Doesn't this break $projects_list = "/", I wonder?
> 
>> +            # remove the trailing "/"
>> +            $dir =~ s!/+$!!;

So perhaps

        $dir =~ s!(?<=[^/])/+$!!;

(zero-width positive look-behind assertion).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-03 11:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-03  5:11 [PATCH] gitweb: Remove extra "/" in path names for git_get_project_list Aneesh Kumar K.V
2006-11-03  5:59 ` Junio C Hamano
2006-11-03 11:18   ` Jakub Narebski

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).