Skip to content

Bug: delete-messages API silently fails with UUID message IDs + Date header not parsed when X-MS-TNEF-Correlator is corrupted #332

Description

@xleclercq13

Bug 1: DELETE /api/v1/delete-messages silently fails with UUID message IDs

Description

The delete-messages endpoint accepts the request (returns HTTP 200) but does not actually delete the messages when using UUID-format message IDs (as returned by search-messages).

Steps to reproduce

  1. Search for messages and get their id field (UUID format, e.g. 2c5bb927-e095-40fa-8189-15a0c5ffb3d2)
  2. Call POST /api/v1/delete-messages with payload {"<mailbox_id>": ["<uuid>"]}
  3. Server returns HTTP 200 (empty response)
  4. Search again → messages are still there

Expected behavior

Messages with the given UUIDs should be deleted.

Actual behavior

HTTP 200 returned but messages remain in the database. No error message.

Environment

  • Bichon: rustmailer/bichon:latest (Docker, July 2026)
  • 193K+ messages imported via upload-import API
  • Message IDs are UUIDs (format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

API format tried

# Format 1: {mailbox_id: [message_uuid]}  → HTTP 200 but no deletion
curl -X POST -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' \
  -d '{"7096551626694216": ["2c5bb927-e095-40fa-8189-15a0c5ffb3d2"]}' \
  'http://localhost:15630/api/v1/delete-messages'

# Format 2: {"message_ids": ["uuid"]}  → parse error
curl -X POST -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' \
  -d '{"message_ids": ["2c5bb927-e095-40fa-8189-15a0c5ffb3d2"]}' \
  'http://localhost:15630/api/v1/delete-messages'
# Error: parse request payload error: failed to parse "map_list_string": object key: invalid digit found in string

The error message map_list_string suggests the endpoint expects {numeric_key: [string_values]}, but the actual message IDs from search-messages are UUIDs, not numeric.


Bug 2: Date header not parsed when X-MS-TNEF-Correlator header is corrupted

Description

When importing EML files produced by readpst (libpst), some emails have a corrupted X-MS-TNEF-Correlator header that causes Bichon's Rust parser to fail to find the Date: header, resulting in date=0 (1970-01-01).

Root cause

readpst sometimes corrupts the X-MS-TNEF-Correlator: header by splitting it into:

X-MS-TNEF- from SRVEXCH.tradeco.be ([fe80::172:70a:47d9:6211]) by
 SRVEXCH.tradeco.be ([fe80::172:70a:47d9:6211%10]) with mapi id
 14.02.0247.003; Mon, 11 Jul 2016 17:46:37 +0200
From: Detollenaere Damien <d.detollenaere@thersa-sa.be>
To: Thierry Lazzerini <thierry@lazzerini.be>
... (duplicate headers)
Date: Mon, 11 Jul 2016 15:46:36 +0000

The X-MS-TNEF- line (without :) is treated as a header name, and the following lines are treated as continuation lines. The duplicate From:, To:, etc. headers confuse the parser, which then fails to find the Date: header.

Expected behavior

The parser should find the Date: header regardless of corruption in other headers.

Actual behavior

date=0 (Unix epoch) for 119 out of 193,186 emails (0.06%).

Workaround

Replacing the corrupted X-MS-TNEF- line with X-MS-TNEF-Correlator: and removing the duplicate headers fixes the issue — the parser then correctly finds the Date: header.

EML sample

Can provide a sample EML file if needed for reproduction.

Environment

  • Bichon: rustmailer/bichon:latest (Docker, July 2026)
  • EML source: readpst -e export from Outlook PST file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions