]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 653404: Misleading error message when file to be attached is not readable by...
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 28 Apr 2011 14:47:16 +0000 (16:47 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 28 Apr 2011 14:47:16 +0000 (16:47 +0200)
r/a=LpSolit

attachment.cgi

index 8ea802f44fd505443e5a85c9458dab862b0ec961..f612815e217360983fa8e3f015478a3f4c546d6e 100755 (executable)
@@ -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'),