From e158a095d3ffbf2f6955c0176c89c6a6b6a5fbc9 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 14 Mar 2025 20:20:06 -0500 Subject: [PATCH] receipts/add: Do not query Firefly for empty ID The `transaction` field is usually included in the form submission, even if it is empty. To avoid querying Firefly for an invalid ID and logging a useless error about it, we only query if the field is non-empty. --- src/routes/receipts.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/routes/receipts.rs b/src/routes/receipts.rs index 5285fa0..8282699 100644 --- a/src/routes/receipts.rs +++ b/src/routes/receipts.rs @@ -113,7 +113,11 @@ pub async fn add_receipt( }, } }, - Some(ref id) => match ctx.firefly.get_transaction(id).await { + Some(ref id) if !id.is_empty() => match ctx + .firefly + .get_transaction(id) + .await + { Ok(t) => { let mut needs_update = false; let mut update = TransactionUpdate::from(t.data.clone()); @@ -166,6 +170,7 @@ pub async fn add_receipt( None }, }, + Some(_) => None, None => None, }; if let Some(xact) = xact {