aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2024-02-23 11:40:15 -0500
committerRobin Jarry <robin@jarry.cc>2024-04-02 22:22:14 +0200
commit3ee53c3012ea2a01bfce19c087c6ed0c8251a797 (patch)
tree81c4eee253e7b6336a44fb117822c95eb3164c0c
parente4ad97a3f0c437381cf08e3c8bb008c8a9487d01 (diff)
downloadaerc-3ee53c3012ea2a01bfce19c087c6ed0c8251a797.tar.gz
aerc-3ee53c3012ea2a01bfce19c087c6ed0c8251a797.zip
notmuch: ignore duplicate msg ID error on delete
According to the comments in notmuch.h, removing a file returns NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID when the "filename was removed but the message persists in the database with at least one other filename." Based on the fact that the db.DeleteMessage() function is used in a context that explicitly recognizes the possibility of multiple files and only attempts to delete one of them, I'm fairly certain that the existing behavior of ignoring all errors *except* the deplicate message ID error is the result of a typo. (It also doesn't make sense to ignore other errors, such as NOTMUCH_STATUS_XAPIAN_EXCEPTION.) Cc: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Jason Cox <me@jasoncarloscox.com> Tested-by: Maarten Aertsen <maarten@nlnetlabs.nl> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--worker/notmuch/lib/database.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go
index 4d853642..9e66b2ae 100644
--- a/worker/notmuch/lib/database.go
+++ b/worker/notmuch/lib/database.go
@@ -230,7 +230,7 @@ func (db *DB) DeleteMessage(filename string) error {
}
}()
err = db.db.RemoveFile(filename)
- if err != nil && errors.Is(err, notmuch.STATUS_DUPLICATE_MESSAGE_ID) {
+ if err != nil && !errors.Is(err, notmuch.STATUS_DUPLICATE_MESSAGE_ID) {
return err
}
return nil