From 22cb42e06e5b4f621017c58ddb154ed3ceb2eb36 Mon Sep 17 00:00:00 2001 From: laxmanhalaki Date: Fri, 26 Dec 2025 16:07:25 +0530 Subject: [PATCH] typescript issue on build resolved --- src/pages/Requests/Requests.tsx | 1 + src/services/workflowApi.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/Requests/Requests.tsx b/src/pages/Requests/Requests.tsx index eaebc7a..9c7fc45 100644 --- a/src/pages/Requests/Requests.tsx +++ b/src/pages/Requests/Requests.tsx @@ -184,6 +184,7 @@ export function Requests({ onViewRequest }: RequestsProps) { statsEndDate ? statsEndDate.toISOString() : undefined, undefined, // status - All Requests stats show all statuses, not filtered by status filtersWithoutStatus?.priority, + undefined, // templateType filtersWithoutStatus?.department, filtersWithoutStatus?.initiator, filtersWithoutStatus?.approver, diff --git a/src/services/workflowApi.ts b/src/services/workflowApi.ts index 1e56425..22e51b2 100644 --- a/src/services/workflowApi.ts +++ b/src/services/workflowApi.ts @@ -379,7 +379,7 @@ function extractFilenameFromContentDisposition(contentDisposition: string | null // Try to extract from filename* first (RFC 5987 encoded) - preferred for non-ASCII const filenameStarMatch = contentDisposition.match(/filename\*=UTF-8''([^;]+)/); - if (filenameStarMatch) { + if (filenameStarMatch && filenameStarMatch[1]) { try { return decodeURIComponent(filenameStarMatch[1]); } catch { @@ -389,9 +389,11 @@ function extractFilenameFromContentDisposition(contentDisposition: string | null // Fallback to regular filename (for ASCII-only filenames) const filenameMatch = contentDisposition.match(/filename="?([^";]+)"?/); - if (filenameMatch) { + if (filenameMatch && filenameMatch.length > 1 && filenameMatch[1]) { // Remove quotes and extract only the filename part (before any semicolon) - const extracted = filenameMatch[1].replace(/^"|"$/g, '').split(';')[0].trim(); + const filenameValue: string = filenameMatch[1]; + const parts = filenameValue.replace(/^"|"$/g, '').split(';'); + const extracted = parts[0]?.trim(); return extracted || 'download'; }