Commit 737ffe4a authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 622455: The attachment mime type autodetection shouldn't rely on the browser…

Bug 622455: The attachment mime type autodetection shouldn't rely on the browser when it gets text/x-* r=dkl a=glob
parent 27398a73
...@@ -541,9 +541,8 @@ sub _check_content_type { ...@@ -541,9 +541,8 @@ sub _check_content_type {
# If we have autodetected application/octet-stream from the Content-Type # If we have autodetected application/octet-stream from the Content-Type
# header, let's have a better go using a sniffer if available. # header, let's have a better go using a sniffer if available.
if (defined Bugzilla->input_params->{contenttypemethod} if ((Bugzilla->input_params->{contenttypemethod} // '') eq 'autodetect'
&& Bugzilla->input_params->{contenttypemethod} eq 'autodetect' && ($content_type eq 'application/octet-stream' || $content_type =~ m{text/x-})
&& $content_type eq 'application/octet-stream'
&& Bugzilla->feature('typesniffer')) && Bugzilla->feature('typesniffer'))
{ {
import File::MimeInfo::Magic qw(mimetype); import File::MimeInfo::Magic qw(mimetype);
...@@ -574,8 +573,7 @@ sub _check_content_type { ...@@ -574,8 +573,7 @@ sub _check_content_type {
# Make sure patches are viewable in the browser # Make sure patches are viewable in the browser
if (!ref($invocant) if (!ref($invocant)
&& defined Bugzilla->input_params->{contenttypemethod} && (Bugzilla->input_params->{contenttypemethod} // '') eq 'autodetect'
&& Bugzilla->input_params->{contenttypemethod} eq 'autodetect'
&& $content_type =~ m{text/x-(?:diff|patch)}) && $content_type =~ m{text/x-(?:diff|patch)})
{ {
$params->{ispatch} = 1; $params->{ispatch} = 1;
......
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