Skip to content

Commit b161e13

Browse files
author
Mark
committed
fixed URI encoding
1 parent e4c4d8e commit b161e13

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
v4.1.9 (2017-02-xx)
22
---------------------------
33
* added missing IndexType.edge
4+
* fixed URI encoding
45

56
v4.1.8 (2017-02-03)
67
---------------------------

src/main/java/com/arangodb/internal/ArangoExecutor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected String createPath(final String... params) {
9292
if (params[i].contains(SLASH)) {
9393
param = createPath(params[i].split(SLASH));
9494
} else {
95-
param = URLEncoder.encode(params[i], "UTF-8");
95+
param = encode(params[i]);
9696
}
9797
sb.append(param);
9898
} catch (final UnsupportedEncodingException e) {
@@ -102,6 +102,11 @@ protected String createPath(final String... params) {
102102
return sb.toString();
103103
}
104104

105+
private String encode(final String value) throws UnsupportedEncodingException {
106+
return URLEncoder.encode(value, "UTF-8").replaceAll("\\+", "%20").replaceAll("\\%21", "!")
107+
.replaceAll("\\%27", "'").replaceAll("\\%28", "(").replaceAll("\\%29", ")").replaceAll("\\%7E", "~");
108+
}
109+
105110
public void validateDocumentKey(final String key) throws ArangoDBException {
106111
validateName("document key", REGEX_DOCUMENT_KEY, key);
107112
}

0 commit comments

Comments
 (0)