@matheusbsbs / matheus-bagliano / commits / 49f582a040
Fork 0

gitweb: Make use of $PATH_INFO for project parameter

Allow to have project name in the path part of URL, just after the name of script. For example instead of gitweb.cgi?p=git.git you can write gitweb.cgi/git.git or gitweb.cgi/git.git/ Not used in URLs inside gitweb; it means that the above alternate syntax must be generated by hand, at least for now. Side effect: project name parameter is now stripped of leading and trailing slash before validation. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Jun 21, 2006 at 17:06 UTC 49f582a0401f3b9b9a80ff6fe0dd601520579b7d
1 file changed +2 -1
gitweb/gitweb.cgi
+2 -1
@@ -86,8 +86,9 @@ if (defined $order) {
86 }
87 }
88
89 -my $project = $cgi->param('p');
89 +my $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
90 if (defined $project) {
91 + $project =~ s|^/||; $project =~ s|/$||;
92 $project = validate_input($project);
93 if (!defined($project)) {
94 die_error(undef, "Invalid project parameter.");