From 4e54c19ee5296e1300ae9bf7cf9464fc7541d73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sat, 19 Feb 2022 17:30:55 +0100 Subject: [PATCH] disallow empty attributes in entries --- src/database/entry.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/database/entry.rs b/src/database/entry.rs index e14ff3b..5e4a984 100644 --- a/src/database/entry.rs +++ b/src/database/entry.rs @@ -60,6 +60,9 @@ impl TryFrom<&Entry> for models::Entry { type Error = anyhow::Error; fn try_from(e: &Entry) -> Result { + if e.attribute.is_empty() { + return Err(anyhow!("Attribute cannot be empty.")); + } let base_entry = models::Entry { identity: e.address()?.encode()?, entity_searchable: match &e.entity {