From: Frédéric Buclin Date: Tue, 26 Oct 2010 18:21:11 +0000 (+0200) Subject: Bug 607361: Creating an attachment without a "comment" param in the URL causes an... X-Git-Tag: bugzilla-3.6.3~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=039c3460d2956aca72ed3bdd27702f07b4ee2042;p=thirdparty%2Fbugzilla.git Bug 607361: Creating an attachment without a "comment" param in the URL causes an internal error a=LpSolit --- diff --git a/attachment.cgi b/attachment.cgi index 80a9b3c65d..256435b6f3 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -502,6 +502,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 }); @@ -637,7 +638,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 });