Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mail] Fix content processing #16580

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sun.mail.imap.IMAPInputStream;

/**
* The {@link POP3IMAPHandler} is responsible for handling commands, which are
* sent to one of the channels.
Expand Down Expand Up @@ -184,6 +186,14 @@ private void refresh() {
mimeMultipart.writeTo(os);
contentAsString = os.toString();
}
} else if (rawContent instanceof IMAPInputStream imapInputStream) {
logger.trace("Detected IMAPInputStream message");
try {
contentAsString = new String(imapInputStream.readAllBytes());
} catch (IOException e) {
logger.warn("Could not read from stream: {}", e.getMessage(), e);
continue;
}
} else {
logger.warn(
"Failed to convert mail content from '{}' with subject '{}', to String: {}",
Expand Down