Skip to content

Commit

Permalink
Fix invalid URI error for forum username that can contain a space (#6937
Browse files Browse the repository at this point in the history
)

This fix URI encodes a forums username to avoid a URI encoding
error, EG: user name contains a space.

Fixes: #6737
  • Loading branch information
DanVanAtta authored Jun 30, 2020
1 parent d6ca9d9 commit 30b7244
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.http.util.EntityUtils;
import org.snakeyaml.engine.v2.api.Load;
import org.snakeyaml.engine.v2.api.LoadSettings;
import org.snakeyaml.engine.v2.common.UriEncoder;
import org.triplea.awt.OpenFileUtility;
import org.triplea.util.Arrays;

Expand Down Expand Up @@ -217,7 +218,8 @@ private void checkUser(final Map<?, ?> jsonObject) {
}

private Map<?, ?> queryUserInfo(final CloseableHttpClient client) throws IOException {
final HttpGet post = new HttpGet(forumUrl + "/api/user/username/" + username);
final String getUserInfoUri = forumUrl + "/api/user/username/" + UriEncoder.encode(username);
final HttpGet post = new HttpGet(getUserInfoUri);
HttpProxy.addProxy(post);
try (CloseableHttpResponse response = client.execute(post)) {
return (Map<?, ?>) load.loadFromString(EntityUtils.toString(response.getEntity()));
Expand Down

0 comments on commit 30b7244

Please sign in to comment.