diff options
-rw-r--r-- | worker/maildir/worker.go | 4 | ||||
-rw-r--r-- | worker/notmuch/worker.go | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index ec344558..d60315b8 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -708,6 +708,10 @@ func (w *Worker) msgInfoFromUid(uid uint32) (*models.MessageInfo, error) { } func (w *Worker) handleCheckMail(msg *types.CheckMail) { + if msg.Command == "" { + w.err(msg, fmt.Errorf("checkmail: no command specified")) + return + } ctx, cancel := context.WithTimeout(context.Background(), msg.Timeout) defer cancel() cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command) diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go index 28029b26..36ef10f6 100644 --- a/worker/notmuch/worker.go +++ b/worker/notmuch/worker.go @@ -647,6 +647,10 @@ func (w *worker) sort(uids []uint32, } func (w *worker) handleCheckMail(msg *types.CheckMail) { + if msg.Command == "" { + w.err(msg, fmt.Errorf("checkmail: no command specified")) + return + } ctx, cancel := context.WithTimeout(context.Background(), msg.Timeout) defer cancel() cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command) |