[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
There is a new pull request by nmeum against master on the mblaze repository
https://github.com/nmeum/mblaze mcom-no-drafts
https://github.com/leahneukirchen/mblaze/pull/169
mcom: check if a draft was found when invoking `mcom -r`
Without this patch `mcom -r` would invoke $EDITOR on a directory if the
maildir did not contain any drafts. To prevent this from happening,
check if a draft was found before performing any further processing. If
not, terminate mcom with an error message.
A patch file from https://github.com/leahneukirchen/mblaze/pull/169.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mcom-no-drafts-169.patch --]
[-- Type: text/x-diff, Size: 877 bytes --]
From f27bc561c342db5f106d187517d5f7373468b2a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 12 Jan 2020 16:34:55 +0100
Subject: [PATCH] mcom: check if a draft was found when invoking `mcom -r`
Without this patch `mcom -r` would invoke $EDITOR on a directory if the
maildir did not contain any drafts. To prevent this from happening,
check if a draft was found before performing any further processing. If
not, terminate mcom with an error message.
---
mcom | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mcom b/mcom
index e0aeaf7..3658dcb 100755
--- a/mcom
+++ b/mcom
@@ -250,6 +250,11 @@ else
draftmime="$(printf '%s\n' "$draft" | sed 's,\(.*\)/cur/,\1/tmp/mime-,')"
fi
+if [ -n "$resume" ] && [ -z "$draft" ]; then
+ echo "mcom: no draft found"
+ exit 1
+fi
+
[ -z "$resume" ] &&
{
case "$0" in