]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 607361: Creating an attachment without a "comment" param in the URL causes an...
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 26 Oct 2010 18:19:00 +0000 (20:19 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 26 Oct 2010 18:19:00 +0000 (20:19 +0200)
a=LpSolit

attachment.cgi

index 8f8004b071abf891c8f9bfb2845bf07f5cf5895b..9273b5f2989a56fb04b62f6eb95876597c033a5b 100755 (executable)
@@ -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 });