-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(rest): Ensure proper URL encoding + fix case issues with content type headers #2826
fix(rest): Ensure proper URL encoding + fix case issues with content type headers #2826
Conversation
@@ -71,11 +71,11 @@ public void build(ClassicRequestBuilder builder, HttpCommonRequest request) { | |||
private HttpEntity createEntityForContentType( | |||
ContentType contentType, Map<?, ?> body, HttpCommonRequest request) { | |||
HttpEntity entity; | |||
if (contentType.getMimeType().equals(MULTIPART_FORM_DATA.getMimeType())) { | |||
if (contentType.getMimeType().equalsIgnoreCase(MULTIPART_FORM_DATA.getMimeType())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even parsed, Apache stores the initial value (could be case inconsistent)
// We try to decode the URL first, because it might be encoded already | ||
// which would lead to double encoding. Decoding is safe here, because it does nothing if | ||
// the URL is not encoded. | ||
var decodedUrl = | ||
URLDecoder.decode( | ||
Optional.ofNullable(request.getUrl()).orElse(""), StandardCharsets.UTF_8); | ||
var url = new URL(decodedUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For easier maintenance and testability, could you extract this into a static utility method?
This and the other part and simply return a string.
Successfully created backport PR for |
…type headers (#2826) (#2827) * fix(rest): Ensure proper URL encoding + fix case issues with content type headers (cherry picked from commit e07b88c) Co-authored-by: Jonathan <[email protected]>
Description
Related issues
closes https://github.com/camunda/team-connectors/issues/840