summaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi17
1 files changed, 17 insertions, 0 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index 5f3f91c3b..99b6e533b 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -22,12 +22,14 @@
# Dan Mosedale <dmose@mozilla.org>
# Joe Robins <jmrobins@tgix.com>
# Gervase Markham <gerv@gerv.net>
+# Marc Schumann <wurblzap@gmail.com>
use strict;
use lib qw(.);
require "globals.pl";
use Bugzilla;
+use Bugzilla::Attachment;
use Bugzilla::Constants;
use Bugzilla::Util;
use Bugzilla::Bug;
@@ -546,6 +548,21 @@ $dbh->do("UPDATE bugs SET creation_ts = ? WHERE bug_id = ?",
$dbh->bz_unlock_tables();
+# Add an attachment if requested.
+if (defined($cgi->upload('data')) || $cgi->param('attachurl')) {
+ $cgi->param('isprivate', $cgi->param('commentprivacy'));
+ Bugzilla::Attachment->insert_attachment_for_bug(!THROW_ERROR,
+ $id, $user, $timestamp,
+ \$vars)
+ || ($vars->{'message'} = 'attachment_creation_failed');
+
+ # Determine if Patch Viewer is installed, for Diff link
+ eval {
+ require PatchReader;
+ $vars->{'patchviewerinstalled'} = 1;
+ };
+}
+
# Email everyone the details of the new bug
$vars->{'mailrecipients'} = {'changer' => $user->login};