~rjarry/aerc-devel

aerc: commands/msg: only select non-attachment part for reply/forward v1 NEEDS REVISION

Sebastien Binet: 1
 commands/msg: only select non-attachment part for reply/forward

 1 files changed, 2 insertions(+), 1 deletions(-)
#1149893 alpine-edge.yml success
#1149894 openbsd.yml success
Sebastien Binet, Feb 14, 2024 at 18:41:
Next

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/49490/mbox | git am -3
Learn more about email & git

[PATCH aerc v1] commands/msg: only select non-attachment part for reply/forward Export this patch

Modify getMessagePart to only return selected message part if it
isn't an attachment, to prevent accidentally quoting a (possibly)
binary attachment file.
Signed-off-by: Sebastien Binet <s@sbinet.org>
---
 commands/msg/utils.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commands/msg/utils.go b/commands/msg/utils.go
index d6dffd50..022e79bf 100644
--- a/commands/msg/utils.go
+++ b/commands/msg/utils.go
@@ -63,7 +63,8 @@ func (h *helper) messages() ([]*models.MessageInfo, error) {

func getMessagePart(msg *models.MessageInfo, provider app.ProvidesMessage) []int {
	p := provider.SelectedMessagePart()
	if p != nil {
	// return selected part only if not an attachment.
	if p != nil && (p.Part == nil || p.Part.Disposition != "attachment") {
		return p.Index
	}
	for _, mime := range config.Viewer.Alternatives {
-- 
2.43.1
While I agree this could be improved along Bence's proposals, I also think
that this patch is already better than what we had.

I'm having trouble in the following situation, however:

(multipart/related)
(multipart/alternative)
      (text/plain)
      (text/html)
    image003.jpg (image/jpeg)
  attachment.pdf (application/pdf)     

If I reply while having "attachment.pdf", it works allright and I get to
reply to the text/plain part. However, if I reply while having
"image003.jpg" selected, I get to reply to the binary representation of
that file.

:-?
aerc/patches: SUCCESS in 2m17s

[commands/msg: only select non-attachment part for reply/forward][0] from [Sebastien Binet][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/49490
[1]: mailto:s@sbinet.org

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