aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-10-05 22:50:40 +0200
committerRobin Jarry <robin@jarry.cc>2022-10-07 10:51:53 +0200
commitc6561d32a8430f99bb84224ba8fde3ddcd44257e (patch)
tree929a575127dcc54a293d86f81d4d11c76aa2f72b /commands
parentd2f4f12f66bc2f632a8a47190fae08ec67c9072e (diff)
downloadaerc-c6561d32a8430f99bb84224ba8fde3ddcd44257e.tar.gz
forward,recall: fix charsets in part attachment
Fix charset to UTF-8 in part attachments. The forward and recall commands fetch message parts with the go-message package which decodes to UTF-8. Hence, we should set the charset of the part attachment to utf-8 and not just copying over the one from the original message. Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r--commands/msg/forward.go5
-rw-r--r--commands/msg/recall.go5
2 files changed, 6 insertions, 4 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index a3459292..6f59a1bb 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -198,12 +198,13 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
}
store.FetchBodyPart(msg.Uid, p, func(reader io.Reader) {
mime := fmt.Sprintf("%s/%s", bs.MIMEType, bs.MIMESubType)
- name, ok := bs.Params["name"]
+ params := lib.SetUtf8Charset(bs.Params)
+ name, ok := params["name"]
if !ok {
name = fmt.Sprintf("%s_%s_%d", bs.MIMEType, bs.MIMESubType, rand.Uint64())
}
mu.Lock()
- composer.AddPartAttachment(name, mime, bs.Params, reader)
+ composer.AddPartAttachment(name, mime, params, reader)
mu.Unlock()
})
}
diff --git a/commands/msg/recall.go b/commands/msg/recall.go
index 4ef505ef..52d4ee89 100644
--- a/commands/msg/recall.go
+++ b/commands/msg/recall.go
@@ -204,12 +204,13 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
}
msg.FetchBodyPart(p, func(reader io.Reader) {
mime := fmt.Sprintf("%s/%s", bs.MIMEType, bs.MIMESubType)
- name, ok := bs.Params["name"]
+ params := lib.SetUtf8Charset(bs.Params)
+ name, ok := params["name"]
if !ok {
name = fmt.Sprintf("%s_%s_%d", bs.MIMEType, bs.MIMESubType, rand.Uint64())
}
mu.Lock()
- composer.AddPartAttachment(name, mime, bs.Params, reader)
+ composer.AddPartAttachment(name, mime, params, reader)
mu.Unlock()
})
}