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:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user