@bobfrankston/mailx-store 0.1.83 → 0.1.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/db.js +5 -2
  2. package/package.json +5 -5
  3. package/store.js +21 -2
package/db.js CHANGED
@@ -4019,8 +4019,11 @@ export class MailxDB {
4019
4019
  }
4020
4020
  else if (folderMatch) {
4021
4021
  const v = folderMatch[1].replace(/"/g, "");
4022
- extraWhere.push("LOWER(f.name) LIKE ?");
4023
- extraParams.push(`%${v.toLowerCase()}%`);
4022
+ // Match the leaf name OR the full path, so both
4023
+ // `folder:rmf` and `folder:lists/rmf` land on the same
4024
+ // folder. LOWER() on both sides keeps it case-insensitive.
4025
+ extraWhere.push("(LOWER(f.name) LIKE ? OR LOWER(f.path) LIKE ?)");
4026
+ extraParams.push(`%${v.toLowerCase()}%`, `%${v.toLowerCase()}%`);
4024
4027
  }
4025
4028
  else if (/^(AND|OR)$/.test(part)) {
4026
4029
  // FTS5 boolean operators — pass through verbatim (must be uppercase).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-store",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,8 +9,8 @@
9
9
  },
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@bobfrankston/mailx-types": "^0.1.40",
13
- "@bobfrankston/mailx-settings": "^0.1.49",
12
+ "@bobfrankston/mailx-types": "^0.1.45",
13
+ "@bobfrankston/mailx-settings": "^0.1.52",
14
14
  "@bobfrankston/mailx-bus": "^0.1.2",
15
15
  "mailparser": "^3.7.2"
16
16
  },
@@ -29,8 +29,8 @@
29
29
  },
30
30
  ".transformedSnapshot": {
31
31
  "dependencies": {
32
- "@bobfrankston/mailx-types": "^0.1.40",
33
- "@bobfrankston/mailx-settings": "^0.1.49",
32
+ "@bobfrankston/mailx-types": "^0.1.45",
33
+ "@bobfrankston/mailx-settings": "^0.1.52",
34
34
  "@bobfrankston/mailx-bus": "^0.1.2",
35
35
  "mailparser": "^3.7.2"
36
36
  }
package/store.js CHANGED
@@ -455,11 +455,30 @@ export class Store {
455
455
  // This runs BEFORE sanitization because Delivered-To feeds the
456
456
  // recipient-allowlist re-check just below.
457
457
  let deliveredTo = "";
458
- const rawDelivered = parsed.headers.get("delivered-to");
459
- if (rawDelivered) {
458
+ // Delivered-To is the qmail/Gmail spelling. Postfix writes
459
+ // X-Original-To and Exim writes Envelope-To for the same fact: the
460
+ // address THIS server accepted the message for. All three are stamped
461
+ // by the RECEIVING MTA, not by the sender or a mailing list, which is
462
+ // what makes them the right key for "which of my identities was this
463
+ // sent to" — a list message where the user appears nowhere in To/Cc
464
+ // still carries the subscriber alias here.
465
+ //
466
+ // Without the alternates, mail arriving through a Postfix/Exim path
467
+ // fell through to scanning To/Cc, and list mail (where the user is
468
+ // not addressed at all) landed on the account default instead of the
469
+ // per-list alias (Bob 2026-08-10: "even if I'm on a list should I see
470
+ // a proper deliver-to?").
471
+ for (const key of ["delivered-to", "x-original-to", "envelope-to"]) {
472
+ const rawDelivered = parsed.headers.get(key);
473
+ if (!rawDelivered)
474
+ continue;
475
+ // Each delivery agent PREPENDS its own, so [0] is the FINAL
476
+ // delivery to this mailbox; later entries are forwarding hops.
460
477
  const deliveredList = Array.isArray(rawDelivered) ? rawDelivered : [rawDelivered];
461
478
  const d = deliveredList[0];
462
479
  deliveredTo = typeof d === "string" ? d : d?.text || d?.address || String(d);
480
+ if (deliveredTo)
481
+ break;
463
482
  }
464
483
  const hdr = (key) => {
465
484
  let v = parsed.headers.get(key);