Closed Bug 1763629 Opened 1 month ago Closed 1 month ago

Forwarding mail as attachment may include invalid characters in filename

Categories

(MailNews Core :: MIME, defect)

Thunderbird 91
defect

Tracking

(thunderbird_esr91 wontfix)

RESOLVED FIXED
101 Branch
Tracking Status
thunderbird_esr91 --- wontfix

People

(Reporter: nils, Assigned: rnons)

Details

Attachments

(3 files)

Attached image spamquestionmark.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36

Steps to reproduce:

I was reporting spam to spamcop, which I do by forwarding (one or more) mails as attachments. The attachment is autogenerated in a new mail, and the filename uses the subject of the original mail.

Version: 91.8.0 (32-bit) running on Windows 10.

Actual results:

In this case, the original mail's subject ended in a question mark. This caused Thunderbird to fail sending the message (with a generic "Mail failed to send" error.)

Expected results:

Invalid characters - question marks are one easy example - should be stripped from the file name when forwarding a mail as an attachment. If I drag the same mail to my windows desktop (for example), this works without issues.

Question mark seems to work for me. Can you upload a test .eml file, so we can import locally and try to reproduce? Thanks.

File attached. Export was done via drag and drop to my desktop.
If I import it - by dragging and dropping it into my inbox - and try to forward as attachment, sending fails. i.e. I can reproduce it.

(As an aside, if I create a new message, then drag and drop the exported EML into that, I can successfully send it.)

The output of the Error Console is as follows (this is only from attempting to send that forward, I cleared it beforehand):

11:20:55.587 Uncaught TypeError: aDocumentNode is undefined
UpdateExtraAddressProcessing chrome://messenger/content/msgHdrView.js:1481
updateExtraAddressProcessing chrome://messenger/content/mailWidgets.js:1256
OnAddressBookDataChanged chrome://messenger/content/msgHdrView.js:443
OnAddressBookDataChanged chrome://messenger/content/msgHdrView.js:437
observe chrome://messenger/content/msgHdrView.js:422
modifyCard resource:///modules/AddrBookDirectory.jsm:453
expandRecipients chrome://messenger/content/messengercompose/MsgComposeCommands.js:7670
GenericSendMessage chrome://messenger/content/messengercompose/MsgComposeCommands.js:4699
SendMessage chrome://messenger/content/messengercompose/MsgComposeCommands.js:5417
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:965
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1143
goDoCommand chrome://global/content/globalOverlay.js:123
oncommand chrome://messenger/content/messengercompose/messengercompose.xhtml:1
msgHdrView.js:1481:1
11:20:55.596
mailnews.send:
Exception { name: "NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS", message: "[JavaScript Error: "Cannot encode <loqrvrxAUJXbUjUpqbrOJ8nHnJ49hmTREaUhehHZQv0AELQUM7ym6MUklPkt13aw4UD81bYIwO91pQL2OaeKMYVYD5hvZiRT2lSUmGtJkthgb3p5-y03p9bkxbnixgary7va1z0rv6hmd0yy69dm9exwga43h5k6266uwwchtjuxail7ipjhu6307yuft5bm186nu9vejf2joegwtq309cz9m-o3gwPZsvyB4qDpaAkxaj8iyh4OHc0kJsbQPQG8c5z6l3mmtwJuFHC4PxJnzAx9TyQzfnxhiXetQqFaNfvjNYetmNGMd4oq-sihw-d26z-bmdkvy47cloy2vwrnEYPKxtmjXtsmyFJGNxL7d1CeFIAOloSFAwccA6Onq6zPC9lfwWcAOFFje5XqkGVK2XNsUsFao5PR51WsOZStvoCzkqPuWB5PpJ791D9gzPXvGVa45ahuwgpmr1v8g1h5dalaytuxtpettthl506s7l4odqnkhufkvqkja56ulbd4ukgpbd88o3msjz3qk906pbfq6cahdecxoidplpbtsm-673718934717750999799265953521388769563044829819888815300763892678635939321303281062602679958225188.n050jeqcu1blxrm38i58q9dsws108c2m3xcc1tfmlgx8ya2wjyvzxyikgaaed3q6r@ZGCDPKIGJZGEPNVFFMXMTCMUFOPRMBFLIIPXSXECXKGNXBSDNPPHRBCXQRPCTUOCDDZVBEXYODLMFEQTUGBMHDJYUYus-575687677-2.673718934717750999799265953521388769563044829819888815300763892678635939321303281062602679958225188.co.uk> due to length." {file: "resource:///modules/jsmime/jsmime.js" line: 3043}]'[JavaScript Error: "Cannot encode <loqrvrxAUJXbUjUpqbrOJ8nHnJ49hmTREaUhehHZQv0AELQUM7ym6MUklPkt13aw4UD81bYIwO91pQL2OaeKMYVYD5hvZiRT2lSUmGtJkthgb3p5-y03p9bkxbnixgary7va1z0rv6hmd0yy69dm9exwga43h5k6266uwwchtjuxail7ipjhu6307yuft5bm186nu9vejf2joegwtq309cz9m-o3gwPZsvyB4qDpaAkxaj8iyh4OHc0kJsbQPQG8c5z6l3mmtwJuFHC4PxJnzAx9TyQzfnxhiXetQqFaNfvjNYetmNGMd4oq-sihw-d26z-bmdkvy47cloy2vwrnEYPKxtmjXtsmyFJGNxL7d1CeFIAOloSFAwccA6Onq6zPC9lfwWcAOFFje5XqkGVK2XNsUsFao5PR51WsOZStvoCzkqPuWB5PpJ791D9gzPXvGVa45ahuwgpmr1v8g1h5dalaytuxtpettthl506s7l4odqnkhufkvqkja56ulbd4ukgpbd88o3msjz3qk906pbfq6cahdecxoidplpbtsm-673718934717750999799265953521388769563044829819888815300763892678635939321303281062602679958225188.n050jeqcu1blxrm38i58q9dsws108c2m3xcc1tfmlgx8ya2wjyvzxyikgaaed3q6r@ZGCDPKIGJZGEPNVFFMXMTCMUFOPRMBFLIIPXSXECXKGNXBSDNPPHRBCXQRPCTUOCDDZVBEXYODLMFEQTUGBMHDJYUYus-575687677-2.673718934717750999799265953521388769563044829819888815300763892678635939321303281062602679958225188.co.uk> due to length." {file: "resource:///modules/jsmime/jsmime.js" line: 3043}]' when calling method: [msgIWritableStructuredHeaders::getRawHeader]", result: 2153185313, filename: "resource:///modules/MimeMessage.jsm", lineNumber: 172, columnNumber: 0, data: XPCWrappedNative_NoHelper, stack: "_gatherMimeHeaders@resource:///modules/MimeMessage.jsm:172:44\n_initMimePart@resource:///modules/MimeMessage.jsm:136:29\ncreateMessageFile@resource:///modules/MimeMessage.jsm:69:24\ncreateAndSendMessage@resource:///modules/MessageSend.jsm:129:41\nCompleteGenericSendMessage@chrome://messenger/content/messengercompose/MsgComposeCommands.js:4962:23\nGenericSendMessage@chrome://messenger/content/messengercompose/MsgComposeCommands.js:4898:29\nSendMessage@chrome://messenger/content/messengercompose/MsgComposeCommands.js:5417:21\ndoCommand@chrome://messenger/content/messengercompose/MsgComposeCommands.js:965:11\ndoCommand@chrome://messenger/content/messengercompose/MsgComposeCommands.js:1143:9\ngoDoCommand@chrome://global/content/globalOverlay.js:123:18\noncommand@chrome://messenger/content/messengercompose/messengercompose.xhtml:1:12\n", location: XPCWrappedNative_NoHelper }
MessageSend.jsm:131:27
11:20:55.596
Error: Cannot encode <loqrvrxAUJXbUjUpqbrOJ8nHnJ49hmTREaUhehHZQv0AELQUM7ym6MUklPkt13aw4UD81bYIwO91pQL2OaeKMYVYD5hvZiRT2lSUmGtJkthgb3p5-y03p9bkxbnixgary7va1z0rv6hmd0yy69dm9exwga43h5k6266uwwchtjuxail7ipjhu6307yuft5bm186nu9vejf2joegwtq309cz9m-o3gwPZsvyB4qDpaAkxaj8iyh4OHc0kJsbQPQG8c5z6l3mmtwJuFHC4PxJnzAx9TyQzfnxhiXetQqFaNfvjNYetmNGMd4oq-sihw-d26z-bmdkvy47cloy2vwrnEYPKxtmjXtsmyFJGNxL7d1CeFIAOloSFAwccA6Onq6zPC9lfwWcAOFFje5XqkGVK2XNsUsFao5PR51WsOZStvoCzkqPuWB5PpJ791D9gzPXvGVa45ahuwgpmr1v8g1h5dalaytuxtpettthl506s7l4odqnkhufkvqkja56ulbd4ukgpbd88o3msjz3qk906pbfq6cahdecxoidplpbtsm-673718934717750999799265953521388769563044829819888815300763892678635939321303281062602679958225188.n050jeqcu1blxrm38i58q9dsws108c2m3xcc1tfmlgx8ya2wjyvzxyikgaaed3q6r@ZGCDPKIGJZGEPNVFFMXMTCMUFOPRMBFLIIPXSXECXKGNXBSDNPPHRBCXQRPCTUOCDDZVBEXYODLMFEQTUGBMHDJYUYus-575687677-2.673718934717750999799265953521388769563044829819888815300763892678635939321303281062602679958225188.co.uk> due to length. jsmime.js:3043:15
11:20:55.597
mailnews.send: Sending failed; , exitCode=2153185313, originalMsgURI=imap-message://nils@ephesus.pandemonium.de/INBOX#84936 MessageSend.jsm:332:27
fail resource:///modules/MessageSend.jsm:332
createAndSendMessage resource:///modules/MessageSend.jsm:139

The _reserveTokenSpace in addText is not very useful because it checks with _hardMargin which is 332 by default. There is a max line length check in addPhrase when emitting headers to string, which should be good enough.

Assignee: nobody → remotenonsense
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Component: Untriaged → MIME
Product: Thunderbird → MailNews Core
Target Milestone: --- → 101 Branch

Pushed by nicolai@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/c978f991cf70
Fix forwarding message with message-id longer than 332 chars. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.