webmail: fix showing attachments that are text/plain and have content-disposition: attachment

they were not added to the list of attachments when sending the message to the
webmail frontend. they were shown on the "open message in new tab" page.
This commit is contained in:
Mechiel Lukkien
2023-09-03 15:20:56 +02:00
parent 4283ceecfc
commit a6ae87d7ac

View File

@ -207,13 +207,11 @@ func parsedMessage(log *mlog.Log, m store.Message, state *msgState, full, msgite
disp, params, err := mime.ParseMediaType(cp)
log.Check(err, "parsing content-disposition", mlog.Field("cp", cp))
if strings.EqualFold(disp, "attachment") {
if full {
name := p.ContentTypeParams["name"]
if name == "" {
name = params["filename"]
}
pm.attachments = append(pm.attachments, Attachment{path, name, p})
name := p.ContentTypeParams["name"]
if name == "" {
name = params["filename"]
}
pm.attachments = append(pm.attachments, Attachment{path, name, p})
return
}
}