]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Use descriptive names in esc_html_hl_regions()
[Gitweb] / gitweb.perl
index 349a7d22f4a9ec4bd421111ae501f7f351dc632160d4ea03bbc51db2afe28452..e8f277c35014e650251461b9e1706750a37afdc0bb6a33f370c09531d1387518 100755 (executable)
@@ -1739,12 +1739,15 @@ sub esc_html_hl_regions {
        my $pos = 0;
 
        for my $s (@sel) {
        my $pos = 0;
 
        for my $s (@sel) {
-               $out .= esc_html(substr($str, $pos, $s->[0] - $pos))
-                       if ($s->[0] - $pos > 0);
-               $out .= $cgi->span({-class => $css_class},
-                                  esc_html(substr($str, $s->[0], $s->[1] - $s->[0])));
+               my ($begin, $end) = @$s;
 
 
-               $pos = $s->[1];
+               my $escaped = esc_html(substr($str, $begin, $end - $begin));
+
+               $out .= esc_html(substr($str, $pos, $begin - $pos))
+                       if ($begin - $pos > 0);
+               $out .= $cgi->span({-class => $css_class}, $escaped);
+
+               $pos = $end;
        }
        $out .= esc_html(substr($str, $pos))
                if ($pos < length($str));
        }
        $out .= esc_html(substr($str, $pos))
                if ($pos < length($str));
@@ -3887,6 +3890,7 @@ sub print_feed_meta {
                                '-type' => "application/$type+xml"
                        );
 
                                '-type' => "application/$type+xml"
                        );
 
+                       $href_params{'extra_options'} = undef;
                        $href_params{'action'} = $type;
                        $link_attr{'-href'} = href(%href_params);
                        print "<link ".
                        $href_params{'action'} = $type;
                        $link_attr{'-href'} = href(%href_params);
                        print "<link ".
@@ -7052,6 +7056,10 @@ sub git_snapshot {
 
        my ($name, $prefix) = snapshot_name($project, $hash);
        my $filename = "$name$known_snapshot_formats{$format}{'suffix'}";
 
        my ($name, $prefix) = snapshot_name($project, $hash);
        my $filename = "$name$known_snapshot_formats{$format}{'suffix'}";
+
+       my %co = parse_commit($hash);
+       exit_if_unmodified_since($co{'committer_epoch'}) if %co;
+
        my $cmd = quote_command(
                git_cmd(), 'archive',
                "--format=$known_snapshot_formats{$format}{'format'}",
        my $cmd = quote_command(
                git_cmd(), 'archive',
                "--format=$known_snapshot_formats{$format}{'format'}",
@@ -7061,9 +7069,15 @@ sub git_snapshot {
        }
 
        $filename =~ s/(["\\])/\\$1/g;
        }
 
        $filename =~ s/(["\\])/\\$1/g;
+       my %latest_date;
+       if (%co) {
+               %latest_date = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
+       }
+
        print $cgi->header(
                -type => $known_snapshot_formats{$format}{'type'},
                -content_disposition => 'inline; filename="' . $filename . '"',
        print $cgi->header(
                -type => $known_snapshot_formats{$format}{'type'},
                -content_disposition => 'inline; filename="' . $filename . '"',
+               %co ? (-last_modified => $latest_date{'rfc2822'}) : (),
                -status => '200 OK');
 
        open my $fd, "-|", $cmd
                -status => '200 OK');
 
        open my $fd, "-|", $cmd
This page took 0.257451 seconds and 4 git commands to generate.