File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -816,6 +816,7 @@ pub fn parse_json_path(path: &[u8]) -> Result<Vec<JsonPath>, Error> {
816
816
}
817
817
let s = std:: str:: from_utf8 ( & path[ prev_idx..idx - 2 ] ) ?;
818
818
let json_path = JsonPath :: String ( Cow :: Borrowed ( s) ) ;
819
+
819
820
json_paths. push ( json_path) ;
820
821
} else {
821
822
prev_idx = idx - 1 ;
@@ -849,7 +850,7 @@ pub fn parse_json_path(path: &[u8]) -> Result<Vec<JsonPath>, Error> {
849
850
} else if c != b'"' {
850
851
idx += 1 ;
851
852
} else {
852
- // Try to read to check if has another '"ab"', if has return err
853
+ // Try to read to check if has extra strings, string value can only have one.
853
854
let c = read_char ( path, & mut idx) ;
854
855
match c {
855
856
Ok ( _) => return Err ( Error :: InvalidToken ) ,
@@ -859,7 +860,9 @@ pub fn parse_json_path(path: &[u8]) -> Result<Vec<JsonPath>, Error> {
859
860
}
860
861
let s = std:: str:: from_utf8 ( & path[ prev_idx..idx - 1 ] ) ?;
861
862
let json_path = JsonPath :: String ( Cow :: Borrowed ( s) ) ;
862
- json_paths. push ( json_path) ;
863
+ if json_paths. len ( ) == 0 {
864
+ json_paths. push ( json_path) ;
865
+ }
863
866
} else {
864
867
if c == b':' || c == b'.' {
865
868
if idx == 1 {
You can’t perform that action at this time.
0 commit comments