Skip to content

Commit

Permalink
fix(json/jsonl): set entry_path to none if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfiaschi committed Feb 28, 2024
1 parent 9dd7b17 commit de41d98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/document/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions src/document/jsonl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit de41d98

Please sign in to comment.