Skip to content

Commit a5b2027

Browse files
committed
fix: double-quote in get_path
1 parent 6c270ba commit a5b2027

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/common/jsonb/src/functions.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -839,15 +839,9 @@ pub fn parse_json_path(path: &[u8]) -> Result<Vec<JsonPath>, Error> {
839839
}
840840
} else if c == b'"' {
841841
prev_idx = idx;
842-
loop {
842+
while idx < path.len() {
843843
let c = read_char(path, &mut idx)?;
844-
if c == b'\\' {
845-
idx += 1;
846-
let c = read_char(path, &mut idx)?;
847-
if c == b'"' {
848-
idx += 1;
849-
}
850-
} else if c != b'"' {
844+
if c != b'"' && c != b'\\' {
851845
idx += 1;
852846
} else {
853847
// Try to read to check if has extra strings, string value can only have one.

src/common/jsonb/tests/it/functions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ fn test_parse_json_path() {
363363
JsonPath::String(Cow::from("k3")),
364364
]),
365365
("\"k1\"", vec![JsonPath::String(Cow::from("k1"))]),
366+
("\"k_1\"", vec![JsonPath::String(Cow::from("k_1"))]),
366367
("\"k1k2\"", vec![JsonPath::String(Cow::from("k1k2"))]),
367368
(r#"k1["k2"][1]"#, vec![
368369
JsonPath::String(Cow::from("k1")),

0 commit comments

Comments
 (0)