@matheusbsbs / matheus-bagliano / commits / a2a3bf7b2b
Fork 0

gitweb: Don't use quotemeta on internally generated strings

Do not use quotemeta on internally generated strings such as filenames of snapshot, blobs, etc. quotemeta quotes any characters not matching /A-Za-z_0-9/. Which means that we get strings like this: before: linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz after: linux-2.6.git-5c2d97cb31fb77981797fec46230ca005b865799.tar.gz This patch fixes this. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Luben Tuikov committed Sep 28, 2006 at 16:51 UTC a2a3bf7b2baf0ff64c5b5ffc78d54be82d9967f1
1 file changed +4 -5
gitweb/gitweb.perl
+4 -5
@@ -2660,7 +2660,7 @@ sub git_blob_plain {
2660 print $cgi->header(
2661 -type => "$type",
2662 -expires=>$expires,
2663 - -content_disposition => 'inline; filename="' . quotemeta($save_as) . '"');
2663 + -content_disposition => 'inline; filename="' . "$save_as" . '"');
2664 undef $/;
2665 binmode STDOUT, ':raw';
2666 print <$fd>;
@@ -2835,7 +2835,7 @@ sub git_snapshot {
2835 print $cgi->header(
2836 -type => 'application/x-tar',
2837 -content_encoding => $ctype,
2838 - -content_disposition => 'inline; filename="' . quotemeta($filename) . '"',
2838 + -content_disposition => 'inline; filename="' . "$filename" . '"',
2839 -status => '200 OK');
2840
2841 my $git_command = git_cmd_str();
@@ -2933,7 +2933,6 @@ sub git_commit {
2933
2934 my @views_nav = ();
2935 if (defined $file_name && defined $co{'parent'}) {
2936 - my $parent = $co{'parent'};
2936 push @views_nav,
2937 $cgi->a({-href => href(action=>"blame", hash_parent=>$parent, file_name=>$file_name)},
2938 "blame");
@@ -3145,7 +3144,7 @@ sub git_blobdiff {
3144 -type => 'text/plain',
3145 -charset => 'utf-8',
3146 -expires => $expires,
3148 - -content_disposition => 'inline; filename="' . quotemeta($file_name) . '.patch"');
3147 + -content_disposition => 'inline; filename="' . "$file_name" . '.patch"');
3148
3149 print "X-Git-Url: " . $cgi->self_url() . "\n\n";
3150
@@ -3248,7 +3247,7 @@ sub git_commitdiff {
3247 -type => 'text/plain',
3248 -charset => 'utf-8',
3249 -expires => $expires,
3251 - -content_disposition => 'inline; filename="' . quotemeta($filename) . '"');
3250 + -content_disposition => 'inline; filename="' . "$filename" . '"');
3251 my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
3252 print <<TEXT;
3253 From: $co{'author'}