File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
src/main/java/com/arangodb Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 11package com .arangodb ;
22
33import com .arangodb .internal .ArangoRequestParam ;
4+ import com .arangodb .internal .util .EncodeUtils ;
45import com .arangodb .util .UnicodeUtils ;
56
67import java .util .Objects ;
@@ -62,6 +63,13 @@ public String get() {
6263 return value ;
6364 }
6465
66+ /**
67+ * @return the value encoded for usage in HTTP urls.
68+ */
69+ public String getEncoded () {
70+ return EncodeUtils .encodeURIComponent (value );
71+ }
72+
6573 @ Override
6674 public boolean equals (Object o ) {
6775 if (this == o ) return true ;
Original file line number Diff line number Diff line change 2121package com .arangodb .internal .http ;
2222
2323import com .arangodb .ArangoDBException ;
24+ import com .arangodb .DbName ;
2425import com .arangodb .Protocol ;
2526import com .arangodb .internal .net .Connection ;
2627import com .arangodb .internal .net .HostDescription ;
@@ -238,10 +239,10 @@ public void close() throws IOException {
238239 }
239240
240241 private static String buildUrl (final String baseUrl , final Request request ) {
241- final StringBuilder sb = new StringBuilder ().append (baseUrl );
242- final String database = request .getDbName (). get ();
243- if (database != null && !database .isEmpty ()) {
244- sb .append ("/_db/" ).append (database );
242+ StringBuilder sb = new StringBuilder ().append (baseUrl );
243+ DbName dbName = request .getDbName ();
244+ if (dbName != null && !dbName . get () .isEmpty ()) {
245+ sb .append ("/_db/" ).append (dbName . getEncoded () );
245246 }
246247 sb .append (request .getRequest ());
247248 if (!request .getQueryParam ().isEmpty ()) {
You can’t perform that action at this time.
0 commit comments