fix: prevent empty file from overwriting existing bill attachments

Fix updateOrAddBill to check file size before processing attachment,
preventing empty blob files from overwriting existing attachments
when updating bill properties.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-29 22:12:23 +02:00
parent 71631ba7ce
commit 8b845261d2

View File

@@ -150,7 +150,9 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
// update the bill in the mongodb
const dbClient = await getDbClient();
const billAttachment = await serializeAttachment(formData.get('billAttachment') as File);
const billAttachmentFile = formData.get('billAttachment') as File;
const billAttachment = billAttachmentFile && billAttachmentFile.size > 0 ?
await serializeAttachment(billAttachmentFile) : null;
if(billId) {