From 5d8ed78ccdbb65a354a9b66b7aa917b2dda853a7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 Jan 2026 13:08:38 +0000 Subject: [PATCH 1/4] Initial plan From a36456d5c7e54d3bdf4061c07e80c45f9b1f554f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 Jan 2026 13:17:53 +0000 Subject: [PATCH 2/4] Add 10-second timeout to fetch operation in fetchLogoAsBase64 Co-authored-by: Anmol1696 <10805402+Anmol1696@users.noreply.github.com> --- functions/send-email-link/src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/send-email-link/src/index.ts b/functions/send-email-link/src/index.ts index c63d21e46..13c02ea6b 100644 --- a/functions/send-email-link/src/index.ts +++ b/functions/send-email-link/src/index.ts @@ -89,7 +89,13 @@ const fetchLogoAsBase64 = async (url: string | undefined): Promise controller.abort(), 10000); // 10 second timeout + + const response = await fetch(url, { signal: controller.signal }); + clearTimeout(timeoutId); + if (!response.ok) return url; const buffer = await response.arrayBuffer(); From 305bb04f30173e960f64e3242eb9ff894d9f6247 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 Jan 2026 13:18:54 +0000 Subject: [PATCH 3/4] Move clearTimeout to finally block to prevent memory leaks Co-authored-by: Anmol1696 <10805402+Anmol1696@users.noreply.github.com> --- functions/send-email-link/src/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/send-email-link/src/index.ts b/functions/send-email-link/src/index.ts index 13c02ea6b..82c61276a 100644 --- a/functions/send-email-link/src/index.ts +++ b/functions/send-email-link/src/index.ts @@ -88,13 +88,12 @@ const MAX_LOGO_SIZE_BYTES = 50 * 1024; const fetchLogoAsBase64 = async (url: string | undefined): Promise => { if (!url) return undefined; - try { - // Add timeout to prevent hanging on unresponsive servers - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout + // Add timeout to prevent hanging on unresponsive servers + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout + try { const response = await fetch(url, { signal: controller.signal }); - clearTimeout(timeoutId); if (!response.ok) return url; @@ -116,6 +115,8 @@ const fetchLogoAsBase64 = async (url: string | undefined): Promise Date: Thu, 22 Jan 2026 13:19:39 +0000 Subject: [PATCH 4/4] Remove trailing whitespace Co-authored-by: Anmol1696 <10805402+Anmol1696@users.noreply.github.com> --- functions/send-email-link/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/send-email-link/src/index.ts b/functions/send-email-link/src/index.ts index 82c61276a..ad3e363ef 100644 --- a/functions/send-email-link/src/index.ts +++ b/functions/send-email-link/src/index.ts @@ -94,7 +94,7 @@ const fetchLogoAsBase64 = async (url: string | undefined): Promise