Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1From 93bec0de8ed5ab3d6b1f01026fe2ef20fa154329 Mon Sep 17 00:00:00 2001 2From: Robin Jarry <robin@jarry.cc> 3Date: Wed, 9 Apr 2025 10:49:24 +0200 4Subject: [PATCH] open: only use part basename for temp file 5 6When an attachment part has a name such as "/tmp/55208186_AllDocs.pdf", 7aerc creates a temp folder and tries to store the file by blindly 8concatenating the path as follows: 9 10 /tmp/aerc-3444057757/tmp/55208186_AllDocs.pdf 11 12And when writing to this path, it gets a "No such file or directory" 13error because the intermediate "tmp" subfolder isn't created. 14 15Reported-by: Erik Colson <eco@ecocode.net> 16Signed-off-by: Robin Jarry <robin@jarry.cc> 17--- 18 commands/msgview/open.go | 3 ++- 19 1 file changed, 2 insertions(+), 1 deletion(-) 20 21diff --git a/commands/msgview/open.go b/commands/msgview/open.go 22index 4293b7e4892c137a7f3fbbe79245ffb6733b2671..a6e43cb8da5fd49d2aa562d4c25ee2d597deefc3 100644 23--- a/commands/msgview/open.go 24+++ b/commands/msgview/open.go 25@@ -5,6 +5,7 @@ import ( 26 "io" 27 "mime" 28 "os" 29+ "path" 30 "path/filepath" 31 32 "git.sr.ht/~rjarry/aerc/app" 33@@ -56,7 +57,7 @@ func (o Open) Execute(args []string) error { 34 app.PushError(err.Error()) 35 return 36 } 37- filename := part.FileName() 38+ filename := path.Base(part.FileName()) 39 var tmpFile *os.File 40 if filename == "" { 41 extension := ""