@matheusbsbs / matheus-bagliano / commits / 8391548e5e
Fork 0

gitweb: fix over-eager application of esc_html().

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>

Petr Baudis committed Sep 24, 2006 at 14:57 UTC 8391548e5e78677eb81f97334d998418802ea194
1 file changed +6 -6
gitweb/gitweb.perl
+6 -6
@@ -3062,12 +3062,12 @@ sub git_blobdiff {
3062 if (defined $file_name) {
3063 if (defined $file_parent) {
3064 $diffinfo{'status'} = '2';
3065 - $diffinfo{'from_file'} = esc_html($file_parent);
3066 - $diffinfo{'to_file'} = esc_html($file_name);
3065 + $diffinfo{'from_file'} = $file_parent;
3066 + $diffinfo{'to_file'} = $file_name;
3067 } else { # assume not renamed
3068 $diffinfo{'status'} = '1';
3069 - $diffinfo{'from_file'} = esc_html($file_name);
3070 - $diffinfo{'to_file'} = esc_html($file_name);
3069 + $diffinfo{'from_file'} = $file_name;
3070 + $diffinfo{'to_file'} = $file_name;
3071 }
3072 } else { # no filename given
3073 $diffinfo{'status'} = '2';
@@ -3136,8 +3136,8 @@ sub git_blobdiff {
3136
3137 } else {
3138 while (my $line = <$fd>) {
3139 - $line =~ s!a/($hash|$hash_parent)!a/$diffinfo{'from_file'}!g;
3140 - $line =~ s!b/($hash|$hash_parent)!b/$diffinfo{'to_file'}!g;
3139 + $line =~ s!a/($hash|$hash_parent)!'a/'.esc_html($diffinfo{'from_file'})!eg;
3140 + $line =~ s!b/($hash|$hash_parent)!'b/'.esc_html($diffinfo{'to_file'})!eg;
3141
3142 print $line;
3143