Skip to content

FLW-8555 - #4295

Open
NathanL3 wants to merge 4 commits into
flowable:mainfrom
NathanL3:FLW-8555
Open

NathanL3 wants to merge 4 commits into
flowable:mainfrom
NathanL3:FLW-8555

Conversation

@NathanL3

Copy link
Copy Markdown

Check List:

  • Unit tests: YES / NO / NA
  • Documentation: YES / NO / NA

nate-flowable and others added 4 commits September 23, 2026 15:40
…nt file names

JakartaMailFlowableMailClient.createMultiPartContent() was manually
RFC-2047-encoding attachment file names with MimeUtility.encodeText()
before handing them to MimeBodyPart.setFileName(). When the resulting
encoded-word string was also too long for one header line, Jakarta
Mail's own RFC 2231 parameter continuation splitting kicked in on top
of it, splitting mid-encoded-word and corrupting the header.

Pass the raw file name to setFileName() instead and let Jakarta Mail's
own RFC 2231 encoding/folding handle it in a single consistent pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e JVM default

The previous fix removed the manual RFC-2047 pre-encoding that corrupted
the Content-Disposition header, but MimeBodyPart.setFileName() ignores
the charset argument passed to createMultiPartContent() entirely: its
default code path RFC 2231-encodes with MimeUtility.getDefaultMIMECharset(),
which resolves to the mail.mime.charset system property or, failing that,
the JVM's file.encoding — neither of which is the charset Flowable
computed for the rest of the message (subject, headers, text/html body).

Build the Content-Disposition header directly via ParameterList/
ContentDisposition instead, passing the charset through explicitly so
the attachment file name is encoded consistently with the rest of the
message regardless of JVM/system defaults.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ttachment file names

- Add two real integration tests to EmailServiceTaskTest (mail service task,
  real SMTP mock server, real MimeMessage on the wire) covering the long
  non-ASCII attachment file name corruption and the charset-fidelity fix,
  following the module's convention of testing through the engine rather
  than by calling internal methods directly.
- When no charset is configured for the message, setAttachmentFileName()
  was falling back to a hardcoded UTF-8, while the text/html body parts
  (MimeBodyPart.setText() with a null charset) fall back to
  MimeUtility.getDefaultMIMECharset(). On a JVM whose default charset
  isn't UTF-8, this could reintroduce a charset mismatch between the
  attachment file name and the rest of the message. Use the same
  default the body already falls back to instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants