From de41d985e4223f41d63e87619a3f590c6a8c8ee3 Mon Sep 17 00:00:00 2001 From: Jean-Marc FIASCHI Date: Wed, 28 Feb 2024 22:50:00 +0100 Subject: [PATCH] fix(json/jsonl): set entry_path to none if empty --- src/document/json.rs | 5 +++++ src/document/jsonl.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/document/json.rs b/src/document/json.rs index 3212da1..bb78d92 100644 --- a/src/document/json.rs +++ b/src/document/json.rs @@ -97,6 +97,11 @@ impl Document for Json { } /// See [`Document::set_entry_path`] for more details. fn set_entry_path(&mut self, entry_path: String) { + if entry_path.is_empty() { + self.entry_path = None; + return; + } + self.entry_path = Some(entry_path); } /// See [`Document::has_data`] for more details. diff --git a/src/document/jsonl.rs b/src/document/jsonl.rs index 18a97ee..314a30b 100644 --- a/src/document/jsonl.rs +++ b/src/document/jsonl.rs @@ -95,6 +95,11 @@ impl Document for Jsonl { } /// See [`Document::set_entry_path`] for more details. fn set_entry_path(&mut self, entry_path: String) { + if entry_path.is_empty() { + self.entry_path = None; + return; + } + self.entry_path = Some(entry_path); } /// See [`Document::read`] for more details.