From 176f1b010855afd2996efdb40e0790e362da47df Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Fri, 28 Jun 2024 15:54:20 +0530 Subject: [PATCH] added validation for the custom partition fields in the log event --- server/src/utils/json/flatten.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/utils/json/flatten.rs b/server/src/utils/json/flatten.rs index 574671321..60a77081d 100644 --- a/server/src/utils/json/flatten.rs +++ b/server/src/utils/json/flatten.rs @@ -122,7 +122,9 @@ pub fn validate_custom_partition( .get(custom_partition_field.trim()) .unwrap() .to_string(); - if custom_partition_value.is_empty() { + if custom_partition_value.is_empty() + || custom_partition_value.eq_ignore_ascii_case("null") + { return Err(anyhow!(format!( "ingestion failed as field {} is empty", custom_partition_field @@ -155,7 +157,7 @@ pub fn validate_time_partition( 30 }; let body_timestamp = value.get(&time_partition.clone().unwrap().to_string()); - if body_timestamp.is_some() { + if body_timestamp.is_some() && body_timestamp.unwrap().to_owned().as_str().is_some() { if body_timestamp .unwrap() .to_owned()