From 45cc062b9f6eca201c34b8257669d2b6d97da800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Thu, 28 Apr 2011 16:47:16 +0200 Subject: Bug 653404: Misleading error message when file to be attached is not readable by browser r/a=LpSolit --- attachment.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'attachment.cgi') diff --git a/attachment.cgi b/attachment.cgi index 8ea802f44..f612815e2 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -487,10 +487,13 @@ sub insert { # Must be called before create() as it may alter $cgi->param('ispatch'). my $content_type = Bugzilla::Attachment::get_content_type(); + # Get the filehandle of the attachment. + my $data_fh = $cgi->upload('data'); + my $attachment = Bugzilla::Attachment->create( {bug => $bug, creation_ts => $timestamp, - data => scalar $cgi->param('attach_text') || $cgi->upload('data'), + data => scalar $cgi->param('attach_text') || $data_fh, description => scalar $cgi->param('description'), filename => $cgi->param('attach_text') ? "file_$bugid.txt" : scalar $cgi->upload('data'), ispatch => scalar $cgi->param('ispatch'), -- cgit v1.2.1