mirror of https://github.com/M66B/FairEmail.git
Fixed protected header encoding
This commit is contained in:
parent
3af2de08f8
commit
eab9dd1fd6
|
@ -155,6 +155,7 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
@ -194,6 +195,7 @@ import javax.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeBodyPart;
|
import javax.mail.internet.MimeBodyPart;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import javax.mail.internet.MimeMultipart;
|
import javax.mail.internet.MimeMultipart;
|
||||||
|
import javax.mail.internet.MimeUtility;
|
||||||
import javax.mail.internet.ParseException;
|
import javax.mail.internet.ParseException;
|
||||||
import javax.mail.util.ByteArrayDataSource;
|
import javax.mail.util.ByteArrayDataSource;
|
||||||
|
|
||||||
|
@ -2360,7 +2362,13 @@ public class FragmentCompose extends FragmentBase {
|
||||||
ContentType ct = new ContentType(type);
|
ContentType ct = new ContentType(type);
|
||||||
ct.setParameter("protected-headers", "v1");
|
ct.setParameter("protected-headers", "v1");
|
||||||
setHeader("Content-Type", ct.toString());
|
setHeader("Content-Type", ct.toString());
|
||||||
setHeader("Subject", draft.subject == null ? "" : draft.subject);
|
String subject = draft.subject == null ? "" : draft.subject;
|
||||||
|
try {
|
||||||
|
setHeader("Subject", MimeUtility.encodeWord(subject));
|
||||||
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
setHeader("Subject", subject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2336,7 +2336,7 @@ public class MessageHelper {
|
||||||
if ("v1".equals(ct.getParameter("protected-headers"))) {
|
if ("v1".equals(ct.getParameter("protected-headers"))) {
|
||||||
String[] subject = part.getHeader("subject");
|
String[] subject = part.getHeader("subject");
|
||||||
if (subject != null && subject.length != 0)
|
if (subject != null && subject.length != 0)
|
||||||
parts.protected_subject = subject[0];
|
parts.protected_subject = decodeMime(subject[0]);
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
|
|
Loading…
Reference in New Issue