gitweb: don't use pathinfo for global actions
With PATH_INFO urls, actions for the projects list (e.g. opml, project_index) were being put in the URL right after the base. The resulting URL is not properly parsed by gitweb itself, since it expects a project name as first component of the URL. Accepting global actions in use_pathinfo is not a very robust solution due to possible present and future conflicts between project names and global actions, therefore we just refuse to create PATH_INFO URLs when the project is not defined. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Giuseppe Bilotta committed
Jan 2, 2009 at 12:34 UTC
fb098a942b925296e0e86b6935a4fdda872e2f99
1 file changed
+2
-2
gitweb/gitweb.perl
+2
-2
@@ -830,7 +830,7 @@ sub href (%) {
830
}
831
832
my $use_pathinfo = gitweb_check_feature('pathinfo');
833
- if ($use_pathinfo) {
833
+ if ($use_pathinfo and defined $params{'project'}) {
834
# try to put as many parameters as possible in PATH_INFO:
835
# - project name
836
# - action
@@ -845,7 +845,7 @@ sub href (%) {
845
$href =~ s,/$,,;
846
847
# Then add the project name, if present
848
- $href .= "/".esc_url($params{'project'}) if defined $params{'project'};
848
+ $href .= "/".esc_url($params{'project'});
849
delete $params{'project'};
850
851
# since we destructively absorb parameters, we keep this