Skip to content

Commit

Permalink
presigned url should also allow null query parameter values
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoten committed Sep 24, 2021
1 parent 6dab4e4 commit 2ab0fe5
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -66,8 +66,10 @@ static String presignedUrl(Clock clock, String url, String method, Map<String, S
includeTokenIfPresent(credentials, h);

List<Parameter> parameters = extractQueryParameters(endpointUrl);
Map<String, String> q = parameters.stream()
.collect(Collectors.toMap(p -> p.name, p -> p.value));
// don't use Collectors.toMap because it doesn't accept null values in map
Map<String, String> q = new HashMap<>();
parameters.forEach(p -> q.put(p.name, p.value));

// construct the query parameter string to accompany the url

// for SignatureV4, the max expiry for a presigned url is 7 days,
Expand Down Expand Up @@ -119,7 +121,7 @@ static ResponseInputStream request(Clock clock, HttpClient httpClient, String ur
h.put("content-length", "" + requestBody.length);
}
h.put("x-amz-content-sha256", contentHashString);

includeTokenIfPresent(credentials, h);

List<Parameter> parameters = extractQueryParameters(endpointUrl);
Expand Down

0 comments on commit 2ab0fe5

Please sign in to comment.