Skip to content

Commit

Permalink
Fixes the problem but leaves a landmine
Browse files Browse the repository at this point in the history
Using apache 5 first fixes the problem because it does encoding correctly, However, if it is not in the classpath then what was once though fixed will break. So, not a fix so much as a minor paving over a gaping hole.

Signed-off-by: Al Niessner <[email protected]>
  • Loading branch information
Al Niessner authored and Al Niessner committed Jul 24, 2024
1 parent c098d8b commit 3a42176
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ public class PathEncoder {
static {
Class<?> clazz = null;
try {
<<<<<<< Updated upstream
// Try Apache HttpClient5 first since this is a default one
=======
// Try Apache HttpClient5 first since this is the "better" encoder
>>>>>>> Stashed changes
clazz = Class.forName(HTTP_CLIENT5_UTILS_CLASS);
} catch (final ClassNotFoundException ex) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void testArrayPathParameter() {
assertEquals("/a/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));

req = RefreshRequest.of(b -> b.index("a", "b"));
<<<<<<< Updated upstream
if (isHttpClient5Present()) {
assertEquals("/a%2Cb/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));

Expand All @@ -70,6 +71,12 @@ public void testArrayPathParameter() {
} else {
assertEquals("/a,b,c/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));
}
=======
assertEquals("/a%2Cb/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));

req = RefreshRequest.of(b -> b.index("a", "b", "c"));
assertEquals("/a%2Cb%2Cc/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));
>>>>>>> Stashed changes
}

@Test
Expand All @@ -80,11 +87,15 @@ public void testPathEncoding() {
assertEquals("/a%2Fb/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));

req = RefreshRequest.of(b -> b.index("a/b", "c/d"));
<<<<<<< Updated upstream
if (isHttpClient5Present()) {
assertEquals("/a%2Fb%2Cc%2Fd/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));
} else {
assertEquals("/a%2Fb,c%2Fd/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));
}
=======
assertEquals("/a%2Fb%2Cc%2Fd/_refresh", RefreshRequest._ENDPOINT.requestUrl(req));
>>>>>>> Stashed changes

}

Expand Down

0 comments on commit 3a42176

Please sign in to comment.