Skip to content

Commit

Permalink
2.2.4 - bugfix ResourceLink needs to encode uri
Browse files Browse the repository at this point in the history
Signed-off-by: Silvio Wangler <71073+saw303@users.noreply.github.com>
  • Loading branch information
saw303 committed Jun 17, 2020
1 parent 31f6ce2 commit 35814d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -27,7 +27,7 @@ buildscript {

subprojects {

version = "2.2.3"
version = "2.2.4"

apply from: "${rootDir}/gradle/java.gradle"
apply from: "${rootDir}/gradle/groovy.gradle"
Expand Down
Expand Up @@ -95,7 +95,7 @@ class RestApiPlugin implements Plugin<Project> {
}

final String springVersion = "5.2.4.RELEASE"
final String pluginVersion = "2.2.3"
final String pluginVersion = "2.2.4"
final String libPhoneNumberVersion = "8.11.5"

project.afterEvaluate {
Expand Down
Expand Up @@ -24,7 +24,10 @@
package ch.silviowangler.rest.model;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -104,6 +107,11 @@ public static ResourceLink selfLink(String uri) {
}

public static ResourceLink relLink(String rel, String uri) {
return new ResourceLink(rel, "GET", URI.create(uri));
try {
return new ResourceLink(
rel, "GET", URI.create(URLEncoder.encode(uri, StandardCharsets.UTF_8.toString())));
} catch (UnsupportedEncodingException e) {
return new ResourceLink(rel, "GET", URI.create(uri));
}
}
}

0 comments on commit 35814d6

Please sign in to comment.