(bugfix) billAction: file type validation was failing if not file was attached

This commit is contained in:
Knee Cola
2025-12-07 16:05:10 +01:00
parent 25865cfae4
commit 47bea328e7

View File

@@ -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' };
}