File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import static java .lang .String .format ;
44import static java .util .Collections .emptyList ;
55
6+ import java .io .UnsupportedEncodingException ;
7+ import java .net .URLDecoder ;
68import java .util .ArrayList ;
79import java .util .List ;
810
@@ -20,6 +22,11 @@ public JSONPointer(String pointer) {
2022 }
2123 if (pointer .startsWith ("#/" )) {
2224 pointer = pointer .substring (2 );
25+ try {
26+ pointer = URLDecoder .decode (pointer , "utf-8" );
27+ } catch (UnsupportedEncodingException e ) {
28+ throw new RuntimeException (e );
29+ }
2330 } else if (pointer .startsWith ("/" )) {
2431 pointer = pointer .substring (1 );
2532 } else {
@@ -32,7 +39,9 @@ public JSONPointer(String pointer) {
3239 }
3340
3441 private String unescape (String token ) {
35- return token .replace ("~1" , "/" ).replace ("~0" , "~" );
42+ return token .replace ("~1" , "/" ).replace ("~0" , "~" )
43+ .replace ("\\ \" " , "\" " )
44+ .replace ("\\ \\ " , "\\ " );
3645 }
3746
3847 public Object queryFrom (JSONObject document ) {
You can’t perform that action at this time.
0 commit comments