Skip to content

Commit

Permalink
fixed case sensitive params grscicoll
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg committed Oct 28, 2024
1 parent 1bcc88a commit 0cc8239
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.gbif.api.model.collections.request.FacetedSearchRequest;
import org.gbif.api.model.collections.request.SearchRequest;
import org.gbif.api.model.common.paging.Pageable;
Expand Down Expand Up @@ -201,9 +202,7 @@ protected <T> Optional<List<T>> extractMultivalueParam(
protected <F extends CollectionsFacetParameter, T extends FacetedSearchRequest<F>>
void fillFacetParams(
T searchRequest, NativeWebRequest webRequest, Function<String, F> facetParamParser) {
final Map<String, String[]> params =
webRequest.getParameterMap().entrySet().stream()
.collect(Collectors.toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
final Map<String, String[]> params = toCaseInsensitiveParams(webRequest);

final String facetMultiSelectValue = getFirstIgnoreCase(params, PARAM_FACET_MULTISELECT);
if (facetMultiSelectValue != null) {
Expand Down Expand Up @@ -284,6 +283,8 @@ protected static void validateIntegerRange(String param, String paramName) {

protected Map<String, String[]> toCaseInsensitiveParams(NativeWebRequest webRequest) {
return webRequest.getParameterMap().entrySet().stream()
.collect(Collectors.toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
.collect(
Collectors.toMap(
e -> e.getKey().toLowerCase(), Map.Entry::getValue, ArrayUtils::addAll));
}
}

0 comments on commit 0cc8239

Please sign in to comment.