Index: mozilla/webtools/bugzilla/Bugzilla/Attachment.pm =================================================================== RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Attachment.pm,v retrieving revision 1.46 diff -up -r1.46 mozilla/webtools/bugzilla/Bugzilla/Attachment.pm --- mozilla/webtools/bugzilla/Bugzilla/Attachment.pm +++ mozilla/webtools/bugzilla/Bugzilla/Attachment.pm @@ -748,6 +748,17 @@ sub insert_attachment_for_bug { # we now check the content type for image/bmp in _validate_data() unless ($cgi->param('ispatch')) { $class->validate_content_type($throw_error) || return; + + # Set the ispatch flag to 1 if we're set to autodetect + # and the content type is text/x-diff or text/x-patch + if (defined $cgi->param('contenttypemethod') + && defined $cgi->param('contenttype') + && $cgi->param('contenttypemethod') eq 'autodetect' + && $cgi->param('contenttype') =~ m{text/x-(?:diff|patch)}) + { + $cgi->param('ispatch', 1); + $cgi->param('contenttype', 'text/plain'); + } } $data = _validate_data($throw_error, $hr_vars); # If the attachment is stored locally, $data eq ''.