~sircmpwn/aerc

Only save the last part of an attachment of which the name is a filepath v1 PROPOSED

Robin Opletal: 1
 Only save the last part of an attachment of which the name is a filepath

 1 files changed, 4 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/19515/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Only save the last part of an attachment of which the name is a filepath Export this patch

---
 commands/msgview/save.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/commands/msgview/save.go b/commands/msgview/save.go
index ef6bba8..375be96 100644
--- a/commands/msgview/save.go
+++ b/commands/msgview/save.go
@@ -182,7 +182,10 @@ func generateFilename(part *models.BodyStructure) string {
		filename = fn
	} else if fn, ok := part.Params["name"]; ok {
		filename = fn
	} else {
	}
	// Used to handle "/", "." and ".." in filenames correctly
	filename = filename[strings.LastIndex(filename, "/")+1:]
	if filename == "" || filename == "." || filename == ".." {
		timestamp := time.Now().Format("2006-01-02-150405")
		filename = fmt.Sprintf("aerc_%v", timestamp)
	}
-- 
2.29.2
Time appropriate greetings,
Thanks for the patch.

On Tue, Jan 12, 2021 at 09:58:54PM +0100, Robin Opletal wrote: