diff options
author | Vitaly Ovchinnikov <v@ovch.ru> | 2024-08-24 09:38:25 +0000 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-08-24 15:49:17 +0200 |
commit | 3ce5670fdcb39cab15000c6248adfd127fd8b398 (patch) | |
tree | 152f66619300995e12dca5e247c738d08c204be1 | |
parent | e00efbc1956bf1f851e80d6439b45ce3cc463d66 (diff) | |
download | aerc-3ce5670fdcb39cab15000c6248adfd127fd8b398.tar.gz |
forward: better preserve attached file names
Use a dedicated filename function for getting a name of the attached
file instad of analyzing its mime type. Some attachments have file name
in `Content-Disposition` rather than `Content-Type`, the new method
handles both cases.
Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru>
Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | commands/msg/forward.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go index cb2cab35..7c491a06 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -236,8 +236,8 @@ func (f forward) Execute(args []string) error { fetchBodyPart(p, func(reader io.Reader) { mime := bs.FullMIMEType() params := lib.SetUtf8Charset(bs.Params) - name, ok := params["name"] - if !ok { + name := bs.FileName() + if name == "" { name = fmt.Sprintf("%s_%s_%d", bs.MIMEType, bs.MIMESubType, rand.Uint64()) } mu.Lock() |