Skip to content

Commit

Permalink
gitweb: fix over-eager application of esc_html().
Browse files Browse the repository at this point in the history
Contents of %diffinfo hash should be quoted upon output but kept
unquoted internally.  Later users of this hash expect filenames
to be filenames, not HTML gibberish.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Petr Baudis authored and Junio C Hamano committed Sep 25, 2006
1 parent 8815788 commit 8391548
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -3062,12 +3062,12 @@ sub git_blobdiff {
if (defined $file_name) {
if (defined $file_parent) {
$diffinfo{'status'} = '2';
$diffinfo{'from_file'} = esc_html($file_parent);
$diffinfo{'to_file'} = esc_html($file_name);
$diffinfo{'from_file'} = $file_parent;
$diffinfo{'to_file'} = $file_name;
} else { # assume not renamed
$diffinfo{'status'} = '1';
$diffinfo{'from_file'} = esc_html($file_name);
$diffinfo{'to_file'} = esc_html($file_name);
$diffinfo{'from_file'} = $file_name;
$diffinfo{'to_file'} = $file_name;
}
} else { # no filename given
$diffinfo{'status'} = '2';
Expand Down Expand Up @@ -3136,8 +3136,8 @@ sub git_blobdiff {

} else {
while (my $line = <$fd>) {
$line =~ s!a/($hash|$hash_parent)!a/$diffinfo{'from_file'}!g;
$line =~ s!b/($hash|$hash_parent)!b/$diffinfo{'to_file'}!g;
$line =~ s!a/($hash|$hash_parent)!'a/'.esc_html($diffinfo{'from_file'})!eg;
$line =~ s!b/($hash|$hash_parent)!'b/'.esc_html($diffinfo{'to_file'})!eg;

print $line;

Expand Down

0 comments on commit 8391548

Please sign in to comment.