File tree 3 files changed +22
-1
lines changed
main/java/com/arangodb/internal
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ v4.1.8 (2017-02-xx)
7
7
* added ArangoCollection.drop(isSystem)
8
8
* improved ArangoDBException with responseCode, errorNum, errorMessage
9
9
* changed ArangoCollection.deleteDocuments() to work with keys and documents
10
+ * fixed URL encoding bug (#97)
10
11
11
12
v4.1.7 (2017-01-26)
12
13
---------------------------
Original file line number Diff line number Diff line change 20
20
21
21
package com .arangodb .internal ;
22
22
23
+ import java .io .UnsupportedEncodingException ;
23
24
import java .lang .reflect .Type ;
25
+ import java .net .URLEncoder ;
24
26
import java .util .Map ;
25
27
import java .util .regex .Pattern ;
26
28
@@ -83,7 +85,17 @@ protected String createPath(final String... params) {
83
85
if (i > 0 ) {
84
86
sb .append ("/" );
85
87
}
86
- sb .append (params [i ]);
88
+ try {
89
+ final String param ;
90
+ if (params [i ].contains ("/" ) || params [i ].contains (" " )) {
91
+ param = params [i ];
92
+ } else {
93
+ param = URLEncoder .encode (params [i ], "UTF-8" );
94
+ }
95
+ sb .append (param );
96
+ } catch (final UnsupportedEncodingException e ) {
97
+ throw new ArangoDBException (e );
98
+ }
87
99
}
88
100
return sb .toString ();
89
101
}
Original file line number Diff line number Diff line change @@ -1660,4 +1660,12 @@ public void getRevision() {
1660
1660
assertThat (result .getRevision (), is (notNullValue ()));
1661
1661
}
1662
1662
1663
+ @ Test
1664
+ public void keyWithPunctuationCharacter () {
1665
+ final String key = "myKey+" ;
1666
+ db .collection (COLLECTION_NAME ).insertDocument (new BaseDocument (key ));
1667
+ final BaseDocument doc = db .collection (COLLECTION_NAME ).getDocument (key , BaseDocument .class );
1668
+ assertThat (doc , is (notNullValue ()));
1669
+ assertThat (doc .getKey (), is (key ));
1670
+ }
1663
1671
}
You can’t perform that action at this time.
0 commit comments