Skip to content

Commit

Permalink
added validation for the custom partition fields in the log event (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsinhaparseable authored Jun 28, 2024
1 parent 055ef0d commit d6116e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/src/utils/json/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit d6116e8

Please sign in to comment.