~rjarry/aerc-devel

aerc: maildir: pass in-memory message to callback v2 SUPERSEDED

Nguyễn Gia Phong: 1
 maildir: pass in-memory message to callback

 1 files changed, 7 insertions(+), 1 deletions(-)
#676513 .build.yml success
Sebastien Binet, Jan 20, 2022 at 14:56:
Next
Sebastien Binet, Jan 20, 2022 at 16:15:
Next
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/~rjarry/aerc-devel/patches/28543/mbox | git am -3
Learn more about email & git

[PATCH aerc v2] maildir: pass in-memory message to callback Export this patch

This fixes piped full message (:pipe -m) being empty.

Fixes: 904ffacb0e52 ("maildir,notmuch: avoid leaking open files")
Signed-off-by: Nguyễn Gia Phong <mcsinyx@disroot.org>
---
BTW thank you Robin Jarry for the pointer to the recommendation
for Linux change log, TIL.
 worker/maildir/worker.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index a671d730fc25..2f75f12ae5e0 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -1,9 +1,11 @@
package maildir

import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"net/url"
	"os"
	"path/filepath"
@@ -433,11 +435,15 @@ func (w *Worker) handleFetchFullMessages(msg *types.FetchFullMessages) error {
			return err
		}
		defer r.Close()
		b, err := ioutil.ReadAll(r)
		if err != nil {
			return err
		}
		w.worker.PostMessage(&types.FullMessage{
			Message: types.RespondTo(msg),
			Content: &models.FullMessage{
				Uid:    uid,
				Reader: r,
				Reader: bytes.NewReader(b),
			},
		}, nil)
	}
-- 
2.34.1
aerc/patches/.build.yml: SUCCESS in 1m14s

[maildir: pass in-memory message to callback][0] v2 from [Nguyễn Gia Phong][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/28543
[1]: mailto:mcsinyx@disroot.org

✓ #676513 SUCCESS aerc/patches/.build.yml https://builds.sr.ht/~rjarry/job/676513
Nguyễn Gia Phong, Jan 20, 2022 at 14:36:
> This fixes piped full message (:pipe -m) being empty.
> 
> Fixes: 904ffacb0e52 ("maildir,notmuch: avoid leaking open files")
> Signed-off-by: Nguyễn Gia Phong <mcsinyx@disroot.org>
> ---
> BTW thank you Robin Jarry for the pointer to the recommendation
> for Linux change log, TIL.
> worker/maildir/worker.go | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
> index a671d730fc25..2f75f12ae5e0 100644
> --- a/worker/maildir/worker.go
> +++ b/worker/maildir/worker.go
> @@ -1,9 +1,11 @@
> package maildir
> 
> import (
> + "bytes"
> "errors"
> "fmt"
> "io"
> + "io/ioutil"
> "net/url"
> "os"
> "path/filepath"
> @@ -433,11 +435,15 @@ func (w *Worker) handleFetchFullMessages(msg
> *types.FetchFullMessages) error {
> return err
> }
> defer r.Close()
> + b, err := ioutil.ReadAll(r)
> + if err != nil {
> + return err
> + }
just a drive-by comment: I don't know what's the policy w/ rjarry/aerc
with regard to supported Go versions (so please take the following with
a grain of salt), but shouldn't we limit our use of deprecated packages?
(io/ioutil is deprecated since ~1.15, IIRC)

ie: shouldn't this read:
b, err := io.ReadAll(r)

instead?

-s