@bobfrankston/rmfmail 1.1.80 → 1.1.81

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.
package/.commitmsg CHANGED
@@ -1,12 +1,20 @@
1
- Fix: opening an attachment did nothing on desktop
2
-
3
- Clicking an attachment chip fired a programmatic <a download> click,
4
- which msger's WebView2 silently drops — so nothing happened and the
5
- failure was swallowed by a console-only catch.
6
-
7
- New service method openAttachment saves the attachment to
8
- ~/.rmfmail/attachments/ and opens it with the OS default app (start /
9
- open / xdg-open), the same in-process pattern as openInWord. The viewer
10
- now calls it on desktop, keeps the native-bridge path for Android, and
11
- falls back to the blob download only for a real browser / --server
12
- mode. Failures now surface via an alert instead of vanishing.
1
+ Fix spurious attachment-open error + blocking alert that stalled sync
2
+
3
+ Three faults behind "failed to open" appearing after the file had
4
+ actually opened in Acrobat:
5
+
6
+ 1. The openAttachment IPC call used the default 30s ceiling. A cold
7
+ parse worker (14-25s) plus a 1.7 MB PDF blew past it, so the client
8
+ rejected even though the service succeeded. getAttachment/
9
+ openAttachment now get a 120s ceiling in mailxapi.js.
10
+
11
+ 2. On that spurious rejection the viewer ran the browser-only blob
12
+ fallback, whose atob() threw "string not correctly encoded". The
13
+ fallback now runs ONLY when openAttachment returns undefined (real
14
+ browser / --server mode); a genuine IPC failure is reported, not
15
+ retried via blob.
16
+
17
+ 3. The failure was shown with window.alert() — a modal that freezes the
18
+ WebView event loop, stalling IPC event delivery so sync looked
19
+ stopped. Replaced with a non-blocking banner via a mailx-alert
20
+ CustomEvent handled by app.ts showAlert().
@@ -1672,13 +1672,9 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1672
1672
  await bridge.openAttachment(att.filename, data2.contentType, data2.content);
1673
1673
  return;
1674
1674
  }
1675
- try {
1676
- const res = await openAttachment(accountId, uid, i, msg.folderId);
1677
- if (res?.ok)
1678
- return;
1679
- } catch (svcErr) {
1680
- console.warn(`[attachment] service open failed, falling back to blob: ${svcErr?.message || svcErr}`);
1681
- }
1675
+ const res = await openAttachment(accountId, uid, i, msg.folderId);
1676
+ if (res)
1677
+ return;
1682
1678
  const data = await getAttachment(accountId, uid, i, msg.folderId);
1683
1679
  const bytes = Uint8Array.from(atob(data.content), (c) => c.charCodeAt(0));
1684
1680
  const blob = new Blob([bytes], { type: data.contentType });
@@ -1694,8 +1690,9 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1694
1690
  URL.revokeObjectURL(url);
1695
1691
  }, 5e3);
1696
1692
  } catch (err) {
1697
- console.error(`Attachment open failed: ${err?.message || err}`);
1698
- alert(`Couldn't open "${att.filename}": ${err?.message || err}`);
1693
+ const m = `Couldn't open "${att.filename}": ${err?.message || err}`;
1694
+ console.error(m);
1695
+ window.dispatchEvent(new CustomEvent("mailx-alert", { detail: { message: m, key: "attachment-open" } }));
1699
1696
  }
1700
1697
  });
1701
1698
  chip.draggable = true;
@@ -6681,6 +6678,10 @@ function showAlert(message, key, opts) {
6681
6678
  }
6682
6679
  }
6683
6680
  }
6681
+ window.addEventListener("mailx-alert", (e) => {
6682
+ const d = e.detail || {};
6683
+ if (d.message) showAlert(String(d.message), d.key);
6684
+ });
6684
6685
  function hideAlert() {
6685
6686
  if (alertBanner) {
6686
6687
  const key = alertBanner.dataset.key;