From: timeless%mozdev.org <> Date: Fri, 20 Jul 2007 08:16:16 +0000 (+0000) Subject: Bug 365756 text/x-patch and text/x-diff should be mapped to [x] patch X-Git-Tag: bugzilla-3.0.1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c5e33e8353f65d174476548d70ba56334ad85e1;p=thirdparty%2Fbugzilla.git Bug 365756 text/x-patch and text/x-diff should be mapped to [x] patch r=lpsolit a=lpsolit --- diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index cf4f475f63..a08c0d511d 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -748,6 +748,15 @@ 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 0; + + # 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 ($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 ''.