msgpart: factorize mime type and filename construction
Reduce code duplication. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
This commit is contained in:
parent
a4b80bcc8b
commit
9bd2e0c84f
8 changed files with 30 additions and 28 deletions
commands/msg
|
@ -198,7 +198,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
continue
|
||||
}
|
||||
store.FetchBodyPart(msg.Uid, p, func(reader io.Reader) {
|
||||
mime := fmt.Sprintf("%s/%s", bs.MIMEType, bs.MIMESubType)
|
||||
mime := bs.FullMIMEType()
|
||||
params := lib.SetUtf8Charset(bs.Params)
|
||||
name, ok := params["name"]
|
||||
if !ok {
|
||||
|
|
|
@ -204,7 +204,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
continue
|
||||
}
|
||||
msg.FetchBodyPart(p, func(reader io.Reader) {
|
||||
mime := fmt.Sprintf("%s/%s", bs.MIMEType, bs.MIMESubType)
|
||||
mime := bs.FullMIMEType()
|
||||
params := lib.SetUtf8Charset(bs.Params)
|
||||
name, ok := params["name"]
|
||||
if !ok {
|
||||
|
|
|
@ -326,7 +326,7 @@ func addMimeType(msg *models.MessageInfo, part []int,
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
orig.MIMEType = fmt.Sprintf("%s/%s", bs.MIMEType, bs.MIMESubType)
|
||||
orig.MIMEType = bs.FullMIMEType()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue