~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

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

Details
Message ID
<20210112205854.271735-1-me@robinopletal.com>
DKIM signature
missing
Download raw message
Patch: +4 -1
---
 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
Details
Message ID
<20210114061959.js2sli3s2f5n4ebx@feather.localdomain>
In-Reply-To
<20210112205854.271735-1-me@robinopletal.com> (view parent)
DKIM signature
missing
Download raw message
Time appropriate greetings,
Thanks for the patch.

On Tue, Jan 12, 2021 at 09:58:54PM +0100, Robin Opletal wrote:
> +	// Used to handle "/", "." and ".." in filenames correctly

When I said add a comment explaining why I meant something a bit more descriptive ;)
Anyhow, fixed it up locally and merged it.
I also took the liberty to change the if chain to a switch statement, which
hopefully helps the reader a bit.

Cheers,
Reto
Details
Message ID
<C8IQEVD69FG8.3HKNU7CMY9WL7@fedora-desktop>
In-Reply-To
<20210114061959.js2sli3s2f5n4ebx@feather.localdomain> (view parent)
DKIM signature
missing
Download raw message
On Thu Jan 14, 2021 at 7:19 AM CET, Reto wrote:
> Time appropriate greetings,
> Thanks for the patch.
>
> On Tue, Jan 12, 2021 at 09:58:54PM +0100, Robin Opletal wrote:
> > +	// Used to handle "/", "." and ".." in filenames correctly
>
> When I said add a comment explaining why I meant something a bit more
> descriptive ;)
> Anyhow, fixed it up locally and merged it.
> I also took the liberty to change the if chain to a switch statement,
> which
> hopefully helps the reader a bit.
>
> Cheers,
> Reto

Hi Reto,

Nice - I have tried to keep it simple with the comment, perhaps I have,
but too simple :)

Best,
Robin
Reply to thread Export thread (mbox)