You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by kb...@apache.org on 2017/09/01 00:04:18 UTC

svn commit: r1806879 - /spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm

Author: kb
Date: Fri Sep  1 00:04:18 2017
New Revision: 1806879

URL: http://svn.apache.org/viewvc?rev=1806879&view=rev
Log:
RFC 2231 section 3: Parameter Value Continuations

Support MIME parameter value continuations for the filename value, which is
actually used by plugins and rules.


Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=1806879&r1=1806878&r2=1806879&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Fri Sep  1 00:04:18 2017
@@ -1122,6 +1122,18 @@ sub parse_content_type {
   my($charset) = $ct =~ /\bcharset\s*=\s*["']?(.*?)["']?(?:;|$)/i;
   my($name) = $ct =~ /\b(?:file)?name\s*=\s*["']?(.*?)["']?(?:;|$)/i;
 
+  # RFC 2231 section 3: Parameter Value Continuations
+  # support continuations for name values
+  #
+  if (!$name && $ct =~ /\b(?:file)?name\*0\s*=/i) {
+
+    my @name;
+    $name[$1] = $2
+      while ($ct =~ /\b(?:file)?name\*(\d+)\s*=\s*["']?(.*?)["']?(?:;|$)/ig);
+
+    $name = join "", grep defined, @name;
+  }
+
   # Get the actual MIME type out ...
   # Note: the header content may not be whitespace unfolded, so make sure the
   # REs do /s when appropriate.