JSIEVE-107 Always do unfold headers to fix long header test match
authorDaniele Depetrini <daniele.depetrini@infocert.it>
Tue, 29 Mar 2016 16:31:46 +0000 (18:31 +0200)
committerbenwa <btellier@linagora.com>
Tue, 22 Aug 2017 08:53:23 +0000 (15:53 +0700)
util/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java

index 58d089e..1f81402 100644 (file)
@@ -33,6 +33,7 @@ import javax.mail.Message;
 import javax.mail.MessagingException;
 import java.io.IOException;
 import java.util.*;
+import javax.mail.internet.MimeUtility;
 
 /**
  * Checks script execution for an email. The wrapped email is set by called
@@ -137,7 +138,10 @@ public class ScriptCheckMailAdapter implements MailAdapter {
             try {
                 String[] values = mail.getHeader(name);
                 if (values != null) {
-                    result = Arrays.asList(values);
+                    //We need to do unfold headers here
+                    result = new LinkedList<String>();
+                    for (String value: values)
+                        result.add(MimeUtility.unfold(value));
                 }
             } catch (MessagingException e) {
                 throw new SieveMailException(e);