Incoming email processing fails with NullPointerException when an attachment/inline part has no filename #3200
Quin opened 13 hours ago

Service desk emails from one particular email client (Titan) fail to process. This happens both when opening an issue and when adding a comment. The sender gets "OneDev is unable to process your message" with:

Cannot invoke "String.indexOf(String)" because "etext" is null

Server log:

ERROR i.o.server.mail.DefaultMailManager Error processing message
java.lang.NullPointerException: Cannot invoke "String.indexOf(String)" because "etext" is null
	at javax.mail.internet.MimeUtility.decodeText(MimeUtility.java:606)
	at io.onedev.server.mail.DefaultMailManager.fillAttachments(DefaultMailManager.java:1110)
	at io.onedev.server.mail.DefaultMailManager.fillAttachments(DefaultMailManager.java:1134)
	at io.onedev.server.mail.DefaultMailManager.parseBody(DefaultMailManager.java:1032)
	at io.onedev.server.mail.DefaultMailManager.addComment(DefaultMailManager.java:656)
	at io.onedev.server.mail.DefaultMailManager.handleMessage(DefaultMailManager.java:480)
	...

The same trace occurs via openIssue(DefaultMailManager.java:703) for new issues.

It looks like fillAttachments passes the part's filename to MimeUtility.decodeText without a null check. The failing emails contain a MIME part treated as an attachment or inline item (likely an inline image) with no filename. Emails from other clients process normally.

Expected: parts without a filename are either skipped or given a generated name, and the email is processed.

I'm not sure if it's related to other "similar issues" offered. First noticed it on 12.0.1.

1/1
Type
Bug
Priority
Major
Assignee
Affected Versions
12.0.1
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-3200
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover