]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 365756 text/x-patch and text/x-diff should be mapped to [x] patch
authortimeless%mozdev.org <>
Fri, 20 Jul 2007 08:16:16 +0000 (08:16 +0000)
committertimeless%mozdev.org <>
Fri, 20 Jul 2007 08:16:16 +0000 (08:16 +0000)
r=lpsolit a=lpsolit

Bugzilla/Attachment.pm

index cf4f475f63f79bc5993b867df2118d129b969f1d..a08c0d511d676e4cf3e3b0ef57954d07cf30ed8e 100644 (file)
@@ -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 ''.