@bobfrankston/rmfmail 1.1.40 → 1.1.42

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.
@@ -9395,6 +9395,10 @@ var AndroidSyncManager = class {
9395
9395
  async addAccount(account) {
9396
9396
  vlog(`addAccount id=${account.id} email=${account.email} host=${account.imap?.host} auth=${account.imap?.auth}`);
9397
9397
  this.db.upsertAccount(account.id, account.name, account.email, JSON.stringify(account));
9398
+ if (this.providers.has(account.id)) {
9399
+ vlog(`addAccount ${account.id}: provider already registered \u2014 keeping it`);
9400
+ return;
9401
+ }
9398
9402
  if (this.isGmailAccount(account)) {
9399
9403
  const tokenProvider2 = this.tokenProviders.get(account.id);
9400
9404
  if (tokenProvider2) {
@@ -9700,14 +9704,20 @@ var AndroidSyncManager = class {
9700
9704
  const envelope = this.db.getMessageByUid(accountId, uid, folderId);
9701
9705
  const bp = envelope?.bodyPath || "";
9702
9706
  const FETCH_TIMEOUT_MS = 6e4;
9707
+ let __folderPath = "(n/a)";
9703
9708
  const fetchPromise = (async () => {
9704
9709
  if (bp.startsWith("gmail:") && provider.fetchById) {
9705
9710
  const providerId = bp.substring(6);
9711
+ __folderPath = `gmail:${bp.substring(6)}`;
9706
9712
  return provider.fetchById(providerId, { source: true });
9707
9713
  }
9708
9714
  const folders = this.db.getFolders(accountId);
9709
9715
  const folder = folders.find((f) => f.id === folderId);
9710
- if (!folder) return null;
9716
+ if (!folder) {
9717
+ __folderPath = "(folder row missing)";
9718
+ return null;
9719
+ }
9720
+ __folderPath = folder.path || "(empty path)";
9711
9721
  return provider.fetchOne(folder.path, uid, { source: true });
9712
9722
  })();
9713
9723
  let msg = null;
@@ -9724,7 +9734,8 @@ var AndroidSyncManager = class {
9724
9734
  throw e;
9725
9735
  }
9726
9736
  if (!msg?.source) {
9727
- console.warn(`[fetchBody] No source returned for ${accountId}/${folderId}/${uid} (bp=${bp}, ${Date.now() - t0}ms)`);
9737
+ const why = msg == null ? "fetchOne returned null" : "message had no .source";
9738
+ console.warn(`[fetchBody] No source returned for ${accountId}/${folderId}/${uid} (bp=${bp}, path=${__folderPath}, ${why}, ${Date.now() - t0}ms)`);
9728
9739
  return null;
9729
9740
  }
9730
9741
  const raw = new TextEncoder().encode(msg.source);