[PATCH aerc] forward: better preserve attached file names
Export this patch
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>
Applied, thanks.
To git@git.sr.ht:~rjarry/aerc
e00efbc1956b..3ce5670fdcb3 master -> master
commands/msg/forward.go | 4 ++ --
1 file 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()
--
2.39.3 (Apple Git-145)
aerc/patches: SUCCESS in 1m59s
[forward: better preserve attached file names][0] from [Vitaly Ovchinnikov][1]
[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/54685
[1]: mailto:v@ovch.ru
✓ #1310814 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1310814
✓ #1310815 SUCCESS aerc/patches/openbsd.yml https://builds.sr.ht/~rjarry/job/1310815
Vitaly Ovchinnikov <v@ovch.ru> wrote: