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.
bugfix/ci-buildah
Dustin 2025-03-14 20:20:06 -05:00
parent f3d31a7256
commit e158a095d3
1 changed files with 6 additions and 1 deletions

View File

@ -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 {