about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2020-01-12 16:34:55 +0100
committerLeah Neukirchen <leah@vuxu.org>2020-01-12 16:55:07 +0100
commit55035ad8b28b407f39def5c2b139a29e7e182958 (patch)
tree3f72642416554f93e4595864cd7ce63bc213d58c
parent6705b3ee2956782a7267d7c4be82c3cbae40c7ed (diff)
downloadmblaze-55035ad8b28b407f39def5c2b139a29e7e182958.tar.gz
mblaze-55035ad8b28b407f39def5c2b139a29e7e182958.tar.xz
mblaze-55035ad8b28b407f39def5c2b139a29e7e182958.zip
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.

Closes: #169 [via git-merge-pr]
-rwxr-xr-xmcom5
1 files changed, 5 insertions, 0 deletions
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