email attachment filenames are sometimes corrupted

Description

I have a strange issue with cfmail and email attachments... If the name of an email attachment contains enough diacritical characters then when the email is delivered the attachment filename will be corrupted.

For example 'ThêQuickBrownFoxJúmpsOverTheDog.docx' is fine but 'ThêQuickBrøwnFoxJúmpsOverTheDog.docx' results in a file name resembling '=UTF-8QTh=C3=AAQuickBr=C3=B8wnFoxJ=C3=BAmpsOverTheDog.docx='.

I'm guessing this is an issue with the length of the filename and handling of utf-8 characters because even a relatively short name like 'ThêQúickƁrøwñƑøx.docx' is corrupted into '=UTF-8QTh=C3=AAQ=C3=BAick=C6=81r=C3=B8w=C3=B1=C6=91=C3=B8x.docx='.

A simpler example: 'ThêQuickBrownêFoxêJumpsOverTheDog.docx' is corrupted but 'ThêQuickBrownêFoxJumpsOverTheDog.docx' is not.

The same files sent via Gmail to the same recipient are delivered with the filenames as you would expect.

I'm thinking this is a Lucee bug but thought I would check here in case someone has seen this before (I couldn't find it in the backlog).

Tested on 5.3.10.79-RC and 5.3.9.141 - and yes, I have the charset attribute set to 'utf-8'

Environment

Lucee 5.3.10.79-RC (Windows) and 5.3.9.141 (Linux)

Attachments

2

Activity

Zac Spitzer 
15 March 2024 at 15:29

windows doesn’t allow newlines in filenames, added a conditional regex to strip them out

Zac Spitzer 
14 March 2024 at 08:51

Pothys - MitrahSoft 
6 February 2024 at 16:47

I've checked this issue with lucee version 6.0.1.63-SNAPSHOT. File names are not corrupted when I send email attachment. This issue seems to be resolved. So I closed this ticket.

Michael Offner 
6 February 2024 at 09:27

added a test case based on the example in the ticket

Michael Offner 
6 February 2024 at 08:28

merged PR

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 27 October 2022 at 11:06
Updated 23 January 2025 at 16:28
Resolved 6 February 2024 at 16:47