]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 413648: Attachment mime type handling should strip leading and trailing spaces
authorFrédéric Buclin <LpSolit@gmail.com>
Fri, 22 Oct 2010 13:01:35 +0000 (15:01 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Fri, 22 Oct 2010 13:01:35 +0000 (15:01 +0200)
a=LpSolit

Bugzilla/Attachment.pm

index 0139922fadf34ad49c52e2bebb7197ea0e767775..a2abebb8d9f768dc5b2ee86d89d9edf6659590ed 100644 (file)
@@ -525,8 +525,9 @@ sub _check_content_type {
     my ($invocant, $content_type) = @_;
 
     $content_type = 'text/plain' if (ref $invocant && ($invocant->isurl || $invocant->ispatch));
+    $content_type = trim($content_type);
     my $legal_types = join('|', LEGAL_CONTENT_TYPES);
-    if ($content_type !~ /^($legal_types)\/.+$/) {
+    if (!$content_type or $content_type !~ /^($legal_types)\/.+$/) {
         ThrowUserError("invalid_content_type", { contenttype => $content_type });
     }
     trick_taint($content_type);