Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 8dc410b

Browse files
committed
#94 Fixing DeployFlexrepTest, encoding space as plus
1 parent 7dd552a commit 8dc410b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/marklogic/rest/util/RestConfig.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ public String toString() {
2929
/**
3030
* Using the java.net.URI constructor that takes a string. Using any other constructor runs into encoding problems,
3131
* e.g. when a mimetype has a plus in it, that plus needs to be encoded, but doing as %2B will result in the % being
32-
* double encoded.
32+
* double encoded. Unfortunately, it seems some encoding is still needed - e.g. for a pipeline like "Flexible Replication"
33+
* with a space in its name, the space must be encoded properly as a "+".
3334
*
3435
* @param path
3536
* @return
3637
*/
3738
public URI buildUri(String path) {
39+
if (path.contains(" ")) {
40+
path = path.replace(" ", "+");
41+
}
3842
try {
3943
return new URI(String.format("%s://%s:%d%s", getScheme(), getHost(), getPort(), path));
4044
} catch (URISyntaxException ex) {
@@ -45,7 +49,7 @@ public URI buildUri(String path) {
4549
public String getBaseUrl() {
4650
return String.format("%s://%s:%d", scheme, host, port);
4751
}
48-
52+
4953
public String getHost() {
5054
return host;
5155
}

0 commit comments

Comments
 (0)