{"thread":{"id":"5754","subject":"[PATCH] gitweb: Don't use quotemeta on internally generated strings","startedAt":"2006-09-28T23:51:43Z","lastAt":"2006-09-28T23:51:43Z","messageCount":1,"participants":["Luben Tuikov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27957","messageId":"20060928235143.9386.qmail@web31804.mail.mud.yahoo.com","threadId":"5754","inReplyTo":null,"subject":"[PATCH] gitweb: Don't use quotemeta on internally generated strings","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-28T23:51:43Z","receivedAt":"2006-09-28T23:51:43Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"Do not use quotemeta on internally generated strings\nsuch as filenames of snapshot, blobs, etc.\nquotemeta quotes any characters not matching /A-Za-z_0-9/.\nWhich means that we get strings like this:\n\nbefore: linux\\-2\\.6\\.git\\-5c2d97cb31fb77981797fec46230ca005b865799\\.tar\\.gz\nafter:  linux-2.6.git-5c2d97cb31fb77981797fec46230ca005b865799.tar.gz\n\nThis patch fixes this.\n\nSigned-off-by: Luben Tuikov <ltuikov@yahoo.com>\n---\n gitweb/gitweb.perl |    9 ++++-----\n 1 files changed, 4 insertions(+), 5 deletions(-)\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 9052647..fdbdb82 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2660,7 +2660,7 @@ sub git_blob_plain {\n \tprint $cgi->header(\n \t\t-type => \"$type\",\n \t\t-expires=>$expires,\n-\t\t-content_disposition => 'inline; filename=\"' . quotemeta($save_as) . '\"');\n+\t\t-content_disposition => 'inline; filename=\"' . \"$save_as\" . '\"');\n \tundef $/;\n \tbinmode STDOUT, ':raw';\n \tprint <$fd>;\n@@ -2835,7 +2835,7 @@ sub git_snapshot {\n \tprint $cgi->header(\n \t\t-type => 'application/x-tar',\n \t\t-content_encoding => $ctype,\n-\t\t-content_disposition => 'inline; filename=\"' . quotemeta($filename) . '\"',\n+\t\t-content_disposition => 'inline; filename=\"' . \"$filename\" . '\"',\n \t\t-status => '200 OK');\n \n \tmy $git_command = git_cmd_str();\n@@ -2933,7 +2933,6 @@ sub git_commit {\n \n \tmy @views_nav = ();\n \tif (defined $file_name && defined $co{'parent'}) {\n-\t\tmy $parent = $co{'parent'};\n \t\tpush @views_nav,\n \t\t\t$cgi->a({-href => href(action=>\"blame\", hash_parent=>$parent, file_name=>$file_name)},\n \t\t\t        \"blame\");\n@@ -3145,7 +3144,7 @@ sub git_blobdiff {\n \t\t\t-type => 'text/plain',\n \t\t\t-charset => 'utf-8',\n \t\t\t-expires => $expires,\n-\t\t\t-content_disposition => 'inline; filename=\"' . quotemeta($file_name) . '.patch\"');\n+\t\t\t-content_disposition => 'inline; filename=\"' . \"$file_name\" . '.patch\"');\n \n \t\tprint \"X-Git-Url: \" . $cgi->self_url() . \"\\n\\n\";\n \n@@ -3248,7 +3247,7 @@ sub git_commitdiff {\n \t\t\t-type => 'text/plain',\n \t\t\t-charset => 'utf-8',\n \t\t\t-expires => $expires,\n-\t\t\t-content_disposition => 'inline; filename=\"' . quotemeta($filename) . '\"');\n+\t\t\t-content_disposition => 'inline; filename=\"' . \"$filename\" . '\"');\n \t\tmy %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});\n \t\tprint <<TEXT;\n From: $co{'author'}\n-- \n1.4.2.1.g05f0f\n\n"}]}