summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-04-28 16:47:16 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-04-28 16:47:16 +0200
commit45cc062b9f6eca201c34b8257669d2b6d97da800 (patch)
tree4f65e7b1b2717e4b3ee0b359aecf505c39c12ea3
parent7e87fb5db0c318644c892210eb4287b09280e014 (diff)
downloadbugzilla-45cc062b9f6eca201c34b8257669d2b6d97da800.tar.gz
bugzilla-45cc062b9f6eca201c34b8257669d2b6d97da800.tar.xz
Bug 653404: Misleading error message when file to be attached is not readable by browser
r/a=LpSolit
-rwxr-xr-xattachment.cgi5
1 files changed, 4 insertions, 1 deletions
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'),