Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private WebTarget writeMap(WebTarget webTarget, String name, Map<String, String>
if (value != null && !value.isEmpty()) {
try {
return webTarget.queryParam(name,
URLEncoder.encode(MAPPER.writeValueAsString(value), "UTF-8"));
URLEncoder.encode(MAPPER.writeValueAsString(value), "UTF-8").replaceAll("\\+", "%20"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afair commons has EscapeUtils that may do this with few other chars.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK EscapeUtils escapes only HTML entities. Commons Lang provides URLCodec which basically behaves the same as URLEncoder (space is converted to +).

} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ public void fromPrivateRegistry() throws Exception {
public void buildArgs() throws Exception {
File baseDir = fileFromBuildTestResource("buildArgs");

String imageId = dockerClient.buildImageCmd(baseDir).withNoCache(true).withBuildArg("testArg", "abc")
String imageId = dockerClient.buildImageCmd(baseDir).withNoCache(true).withBuildArg("testArg", "abc !@#$%^&*()_+")
.exec(new BuildImageResultCallback())
.awaitImageId();

InspectImageResponse inspectImageResponse = dockerClient.inspectImageCmd(imageId).exec();
assertThat(inspectImageResponse, not(nullValue()));
LOG.info("Image Inspect: {}", inspectImageResponse.toString());

assertThat(inspectImageResponse.getConfig().getLabels().get("test"), equalTo("abc"));
assertThat(inspectImageResponse.getConfig().getLabels().get("test"), equalTo("abc !@#$%^&*()_+"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,15 @@ public void fromPrivateRegistry() throws Exception {
public void buildArgs() throws Exception {
File baseDir = fileFromBuildTestResource("buildArgs");

String imageId = dockerClient.buildImageCmd(baseDir).withNoCache(true).withBuildArg("testArg", "abc")
String imageId = dockerClient.buildImageCmd(baseDir).withNoCache(true).withBuildArg("testArg", "abc !@#$%^&*()_+")
.exec(new BuildImageResultCallback())
.awaitImageId();

InspectImageResponse inspectImageResponse = dockerClient.inspectImageCmd(imageId).exec();
assertThat(inspectImageResponse, not(nullValue()));
LOG.info("Image Inspect: {}", inspectImageResponse.toString());

assertThat(inspectImageResponse.getConfig().getLabels().get("test"), equalTo("abc"));
assertThat(inspectImageResponse.getConfig().getLabels().get("test"), equalTo("abc !@#$%^&*()_+"));
}

@Test
Expand Down