add todo's about mime header parameter decoding

not sure what the correct approach is, would need to analyze email archive for practices.
This commit is contained in:
Mechiel Lukkien 2023-09-21 14:51:47 +02:00
parent f87f286b80
commit 79774c15ec
No known key found for this signature in database
4 changed files with 4 additions and 2 deletions

View file

@ -135,6 +135,7 @@ type Attachment struct {
// File name based on "name" attribute of "Content-Type", or the "filename"
// attribute of "Content-Disposition".
// todo: decode non-ascii character sets
Filename string
Part message.Part

View file

@ -1954,7 +1954,7 @@
},
{
"Name": "Filename",
"Docs": "File name based on \"name\" attribute of \"Content-Type\", or the \"filename\" attribute of \"Content-Disposition\".",
"Docs": "File name based on \"name\" attribute of \"Content-Type\", or the \"filename\" attribute of \"Content-Disposition\". todo: decode non-ascii character sets",
"Typewords": [
"string"
]

View file

@ -322,7 +322,7 @@ export interface MessageEnvelope {
// viewable text or HTML part.
export interface Attachment {
Path?: number[] | null // Indices into top-level message.Part.Parts.
Filename: string // File name based on "name" attribute of "Content-Type", or the "filename" attribute of "Content-Disposition".
Filename: string // File name based on "name" attribute of "Content-Type", or the "filename" attribute of "Content-Disposition". todo: decode non-ascii character sets
Part: Part
}

View file

@ -212,6 +212,7 @@ 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") {
// todo: should we be decoding these names? i've seen messages with regular q-word style mime-encoding, not the one specified in ../rfc/2231:210
name := p.ContentTypeParams["name"]
if name == "" {
name = params["filename"]