]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: document webserver configuration for common gitweb/repo URLs.
[Gitweb] / gitweb.perl
index 590ebddff3ceea70fbfe98b6a42c9e289c5d1437cfa0cd3df4281ef08bc3656c..1bcad9cf8ada8160af0e27a138d90b23d37e5e1ab471c2dcd44ffb9692dadf60 100755 (executable)
@@ -102,6 +102,10 @@ our %feature = (
                'sub' => \&feature_pickaxe,
                'override' => 0,
                'default' => [1]},
+
+       'pathinfo' => {
+               'override' => 0,
+               'default' => [0]},
 );
 
 sub gitweb_check_feature {
@@ -375,6 +379,7 @@ exit;
 
 sub href(%) {
        my %params = @_;
+       my $href = $my_uri;
 
        my @mapping = (
                project => "p",
@@ -393,6 +398,19 @@ sub href(%) {
 
        $params{'project'} = $project unless exists $params{'project'};
 
+       my ($use_pathinfo) = gitweb_check_feature('pathinfo');
+       if ($use_pathinfo) {
+               # use PATH_INFO for project name
+               $href .= "/$params{'project'}" if defined $params{'project'};
+               delete $params{'project'};
+
+               # Summary just uses the project path URL
+               if (defined $params{'action'} && $params{'action'} eq 'summary') {
+                       delete $params{'action'};
+               }
+       }
+
+       # now encode the parameters explicitly
        my @result = ();
        for (my $i = 0; $i < @mapping; $i += 2) {
                my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);
@@ -400,7 +418,9 @@ sub href(%) {
                        push @result, $symbol . "=" . esc_param($params{$name});
                }
        }
-       return "$my_uri?" . join(';', @result);
+       $href .= "?" . join(';', @result) if scalar @result;
+
+       return $href;
 }
 
 
@@ -465,6 +485,7 @@ sub esc_html {
        $str = decode("utf8", $str, Encode::FB_DEFAULT);
        $str = escapeHTML($str);
        $str =~ s/\014/^L/g; # escape FORM FEED (FF) character (e.g. in COPYING file)
+       $str =~ s/\033/^[/g; # "escape" ESCAPE (\e) character (e.g. commit 20a3847d8a5032ce41f90dcc68abfb36e6fee9b1)
        return $str;
 }
 
This page took 0.237497 seconds and 4 git commands to generate.