Commit 8073ec46 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 607361: Creating an attachment without a "comment" param in the URL causes an internal error

a=LpSolit
parent 549d83c7
...@@ -504,6 +504,7 @@ sub insert { ...@@ -504,6 +504,7 @@ sub insert {
# Insert a comment about the new attachment into the database. # Insert a comment about the new attachment into the database.
my $comment = $cgi->param('comment'); my $comment = $cgi->param('comment');
$comment = '' unless defined $comment;
$bug->add_comment($comment, { isprivate => $attachment->isprivate, $bug->add_comment($comment, { isprivate => $attachment->isprivate,
type => CMT_ATTACHMENT_CREATED, type => CMT_ATTACHMENT_CREATED,
extra_data => $attachment->id }); extra_data => $attachment->id });
...@@ -639,7 +640,7 @@ sub update { ...@@ -639,7 +640,7 @@ sub update {
# If the user submitted a comment while editing the attachment, # If the user submitted a comment while editing the attachment,
# add the comment to the bug. Do this after having validated isprivate! # add the comment to the bug. Do this after having validated isprivate!
my $comment = $cgi->param('comment'); my $comment = $cgi->param('comment');
if (trim($comment)) { if (defined $comment && trim($comment) ne '') {
$bug->add_comment($comment, { isprivate => $attachment->isprivate, $bug->add_comment($comment, { isprivate => $attachment->isprivate,
type => CMT_ATTACHMENT_UPDATED, type => CMT_ATTACHMENT_UPDATED,
extra_data => $attachment->id }); extra_data => $attachment->id });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment