~rjarry/aerc-devel

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 aerc v1] open: create a file even if filename is empty

Details
Message ID
<20240413213022.358363-2-bence@ferdinandy.com>
DKIM signature
missing
Download raw message
Patch: +12 -1
Without a filename, aerc tries to open a directory. In this case, create
a random filename.

Fixes: d99c49de2fc12b64a7cd79044a8b042e7e59d02b
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
---
 commands/msgview/open.go | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/commands/msgview/open.go b/commands/msgview/open.go
index 55d085f6..1361b15e 100644
--- a/commands/msgview/open.go
+++ b/commands/msgview/open.go
@@ -3,6 +3,7 @@ package msgview
import (
	"errors"
	"io"
	"mime"
	"os"
	"path/filepath"

@@ -55,7 +56,17 @@ func (o Open) Execute(args []string) error {
			app.PushError(err.Error())
			return
		}
		tmpFile, err := os.Create(filepath.Join(tmpDir, part.FileName()))
		filename := part.FileName()
		var tmpFile *os.File
		if filename == "" {
			extension := ""
			if exts, _ := mime.ExtensionsByType(mimeType); len(exts) > 0 {
				extension = exts[0]
			}
			tmpFile, err = os.CreateTemp(tmpDir, "aerc-*"+extension)
		} else {
			tmpFile, err = os.Create(filepath.Join(tmpDir, filename))
		}
		if err != nil {
			app.PushError(err.Error())
			return
-- 
2.43.2

[aerc/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D0JBRTLTJXY3.K3CLFA2M6SHD@fra01>
In-Reply-To
<20240413213022.358363-2-bence@ferdinandy.com> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: SUCCESS in 2m1s

[open: create a file even if filename is empty][0] from [Bence Ferdinandy][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/50994
[1]: bence@ferdinandy.com

✓ #1195109 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1195109
✓ #1195110 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1195110

Applied: [PATCH aerc v1] open: create a file even if filename is empty

Details
Message ID
<171308706680.168822.17035958721419816552@ringo>
In-Reply-To
<20240413213022.358363-2-bence@ferdinandy.com> (view parent)
DKIM signature
pass
Download raw message
Bence Ferdinandy <bence@ferdinandy.com> wrote:
> Without a filename, aerc tries to open a directory. In this case, create
> a random filename.
>
> Fixes: d99c49de2fc12b64a7cd79044a8b042e7e59d02b
> Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
> ---

Acked-by: Robin Jarry <robin@jarry.cc>

Applied with sanitation of the Fixes: trailer, thanks.

To git@git.sr.ht:~rjarry/aerc
   f204c736759f..ae3f7419ce1b  master -> master
Reply to thread Export thread (mbox)