summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2015-04-29 11:41:00 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2015-04-29 11:41:00 +0200
commit737ffe4a360ad028836522bddd658e234e71bbc7 (patch)
treee5b16c03047ec68d03ec4445c041f1fb4a311e98 /Bugzilla
parent27398a737a070decdaa013dd20897c94f84ccfa5 (diff)
downloadbugzilla-737ffe4a360ad028836522bddd658e234e71bbc7.tar.gz
bugzilla-737ffe4a360ad028836522bddd658e234e71bbc7.tar.xz
Bug 622455: The attachment mime type autodetection shouldn't rely on the browser when it gets text/x-*
r=dkl a=glob
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index ed770ad89..ed43cbe94 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -541,9 +541,8 @@ sub _check_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.
- if (defined Bugzilla->input_params->{contenttypemethod}
- && Bugzilla->input_params->{contenttypemethod} eq 'autodetect'
- && $content_type eq 'application/octet-stream'
+ if ((Bugzilla->input_params->{contenttypemethod} // '') eq 'autodetect'
+ && ($content_type eq 'application/octet-stream' || $content_type =~ m{text/x-})
&& Bugzilla->feature('typesniffer'))
{
import File::MimeInfo::Magic qw(mimetype);
@@ -574,8 +573,7 @@ sub _check_content_type {
# Make sure patches are viewable in the browser
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)})
{
$params->{ispatch} = 1;