]> git.cworth.org Git - notmuch/blobdiff - lib/database.cc
lib/n_d_remove_message: do not remove unique filename
[notmuch] / lib / database.cc
index 6987e2f417ae5039294b078836c24f7779b01506..737a3f3060677b4e7fd5a55fbe5268082f0867f2 100644 (file)
@@ -1454,7 +1454,9 @@ notmuch_database_remove_message (notmuch_database_t *notmuch,
                                                        &message);
 
     if (status == NOTMUCH_STATUS_SUCCESS && message) {
-       status = _notmuch_message_remove_filename (message, filename);
+       if (notmuch_message_count_files (message) > 1) {
+           status = _notmuch_message_remove_filename (message, filename);
+       }
        if (status == NOTMUCH_STATUS_SUCCESS)
            status = _notmuch_message_delete (message);
        else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)