We recently upgraded Aspose.Email
from version 19.3
to 20.6
and am running into some problems after the upgrade.
For certain emails the attachment names now contain newline and carriage return characters that doesn’t seem like they should be part of the attachment name.
Example code:
LoadOptions loadOptions = new EmlLoadOptions();
MapiMessage msg = MapiMessage.load(filename, loadOptions);
System.out.println(StringEscapeUtils.escapeJava(msg.getSubject()));
msg.getAttachments().forEach( attachment -> {
// Output escaped attachment name
System.out.println(String.format("Attachment name: %s", StringEscapeUtils.escapeJava(attachment.getDisplayName())));
)};
When running with this file: sample.eml.zip (5.6 KB) we see:
Fwd: This is an email with a very long subject line, it would probably span multiple lines in the resulting EML file(Aspose.Email Evaluation)
Attachment name: This is an email with a very long subject line, it would probably\r\n span multiple lines in the resulting EML file
As you can see there are \r\n
inside the attachment name that doesn’t seem to belong there. If we run this code using Aspose 19.3 we instead get:
Fwd: This is an email with a very long subject line, it would probably span multiple lines in the resulting EML file(Aspose.Email Evaluation)
Attachment name: This is an email with a very long subject line, it would probably span multiple lines in the resulting EML file