You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: MimeMessageParser rejects attachments with duplicate names #219
Essentially replacing the Map with a List<Map.Entry) does the job
It's already called "attachmentList" ;-) parsedComponents.attachmentList.put(cid, cidEntry.getValue());
to parsedComponents.attachmentList.add(new AbstractMap.SimpleEntry(cid, cidEntry.getValue()));
BTW, you can add attachments with the same name in Gmail.
Reference nicolasbelisle@47a47f3 (There's a few other fixes in this commit however).
Seems to be still there in Simple Java Mail 6.5.0:
package org.simplejavamail.converter.internal.mimemessage;
MimeMessageParser :
Line 508 : public Map<String, DataSource> getAttachmentList() {
return this.attachmentList;
}
WIll not work with two attachments named e.g.: TSOL0038
TSOL0038.AUF
i.e. no suffix in one case.
This case is used for electronic billing for healthcare in Germany.
Works fine with different suffixes.
Activity
bbottema commentedon Aug 7, 2019
Is this a real use case?
nicolasbelisle commentedon Aug 7, 2019
Yes. Real email that went through MimeMessageParser (v. 5.1.7).
nicolasbelisle commentedon Aug 8, 2019
Essentially replacing the Map with a List<Map.Entry) does the job
It's already called "attachmentList" ;-)
parsedComponents.attachmentList.put(cid, cidEntry.getValue());to
parsedComponents.attachmentList.add(new AbstractMap.SimpleEntry(cid, cidEntry.getValue()));BTW, you can add attachments with the same name in Gmail.
Reference nicolasbelisle@47a47f3 (There's a few other fixes in this commit however).
bbottema commentedon Aug 9, 2019
Ok, you made a convincing case. If you feel up to it, I'll accept a PR on master! Or else I'll pick it up in due time.
https://github.com/bbottema/simple-java-mail/issues/219
[-]MimeMessageParser and attachments[/-][+]Bug: MimeMessageParser rejects attachments with duplicate names[/+]Merge remote-tracking branch 'remotes/origin/#219-duplicate-attachmen…
bbottema commentedon Aug 16, 2019
Fixed and released in 5.2.1!
DasTier1 commentedon Mar 12, 2021
Seems to be still there in Simple Java Mail 6.5.0:
package org.simplejavamail.converter.internal.mimemessage;
MimeMessageParser :
Line 508 : public Map<String, DataSource> getAttachmentList() {
return this.attachmentList;
}
WIll not work with two attachments named e.g.:
TSOL0038
TSOL0038.AUF
i.e. no suffix in one case.
This case is used for electronic billing for healthcare in Germany.
Works fine with different suffixes.
#249
#219, #249, #310, #351: Properly fix support for duplicate file names…
#219, #249, #310, #351: Properly fix support for duplicate file names…