Fix json_path broken condition

This commit is contained in:
Ihor Andrianov
2025-03-15 22:01:48 +02:00
parent 353422a25c
commit e327707ac6

View File

@@ -328,7 +328,9 @@ fn finalize_path<'a>(
PPState::InKey => {
if key_start < path.len() {
let key = &path[key_start..];
if key.starts_with('"') & !key.ends_with('"') {
if key.starts_with('"') && !key.ends_with('"') && key.len() > 1
|| (key.starts_with('"') && key.ends_with('"') && key.len() == 1)
{
bail_parse_error!("Bad json path: {}", path)
}
path_components.push(PathElement::Key(Cow::Borrowed(key), false));