You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thread 'using_jsonpath_plus::tests::test_delete_in_try_replace' panicked at 'index out of bounds: the len is 2 but the index is 2', /Users/sp/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonpath-plus-0.1.3/src/utils.rs:60:30
stack backtrace:
0: rust_begin_unwind
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
2: core::panicking::panic_bounds_check
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:75:5
3: <usize as core::slice::index::SliceIndex<[T]>>::index
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/slice/index.rs:184:10
4: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/slice/index.rs:15:9
5: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/vec/mod.rs:2528:9
6: jsonpath_plus::utils::try_replace_paths
at /Users/sp/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonpath-plus-0.1.3/src/utils.rs:60:30
7: jsonpath_plus::<impl jsonpath_plus::ast::Path>::try_replace
at /Users/sp/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonpath-plus-0.1.3/src/lib.rs:145:9
8: jsonpath_filter::using_jsonpath_plus::tests::test_delete_in_try_replace
at ./src/using_jsonpath_plus.rs:216:22
9: jsonpath_filter::using_jsonpath_plus::tests::test_delete_in_try_replace::{{closure}}
at ./src/using_jsonpath_plus.rs:214:5
10: core::ops::function::FnOnce::call_once
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:227:5
11: core::ops::function::FnOnce::call_once
at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:227:5
The text was updated successfully, but these errors were encountered:
Darn, I remember briefly realizing this may be an issue while working on this earlier, then I forgot to implement a fix. This happens because a deletion of an earlier element may change the index of later elements. I believe this can be fixed fairly simply by improving the ordering of paths to always work backwards along arrays. I'll publish a fix ASAP
Test to reproduce:
leads to error:
The text was updated successfully, but these errors were encountered: