diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2010-10-26 20:19:00 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2010-10-26 20:19:00 +0200 |
commit | 8073ec468255258f1d7ce72d6204636d8f2f8c45 (patch) | |
tree | 3c0477144b1934a317e2b144034975dbad5ad873 | |
parent | 549d83c76a37ae19795e8fca98a2cbe553ed5c60 (diff) | |
download | bugzilla-8073ec468255258f1d7ce72d6204636d8f2f8c45.tar.gz bugzilla-8073ec468255258f1d7ce72d6204636d8f2f8c45.tar.xz |
Bug 607361: Creating an attachment without a "comment" param in the URL causes an internal error
a=LpSolit
-rwxr-xr-x | attachment.cgi | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/attachment.cgi b/attachment.cgi index 8f8004b07..9273b5f29 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -504,6 +504,7 @@ sub insert { # Insert a comment about the new attachment into the database. my $comment = $cgi->param('comment'); + $comment = '' unless defined $comment; $bug->add_comment($comment, { isprivate => $attachment->isprivate, type => CMT_ATTACHMENT_CREATED, extra_data => $attachment->id }); @@ -639,7 +640,7 @@ sub update { # If the user submitted a comment while editing the attachment, # add the comment to the bug. Do this after having validated isprivate! my $comment = $cgi->param('comment'); - if (trim($comment)) { + if (defined $comment && trim($comment) ne '') { $bug->add_comment($comment, { isprivate => $attachment->isprivate, type => CMT_ATTACHMENT_UPDATED, extra_data => $attachment->id }); |