From 47bea328e7228a45abbcad8885159a5210631729 Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Sun, 7 Dec 2025 16:05:10 +0100 Subject: [PATCH] (bugfix) billAction: file type validation was failing if not file was attached --- app/lib/actions/billActions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/actions/billActions.ts b/app/lib/actions/billActions.ts index c5b09fa..2e60045 100644 --- a/app/lib/actions/billActions.ts +++ b/app/lib/actions/billActions.ts @@ -165,7 +165,7 @@ export const updateOrAddBill = withUser(async (user: AuthenticatedUser, location } // Validate file type - if (attachmentFile && attachmentFile.type !== 'application/pdf') { + if (attachmentFile && attachmentFile.size > 0 && attachmentFile.type !== 'application/pdf') { return { success: false, error: 'Only PDF files are accepted' }; } @@ -503,7 +503,7 @@ export const uploadProofOfPayment = async (locationID: string, billID: string, f } // Validate file type - if (file && file.type !== 'application/pdf') { + if (attachmentFile && attachmentFile.size > 0 && attachmentFile.type !== 'application/pdf') { return { success: false, error: 'Only PDF files are accepted' }; }