Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 06db4fde05 | |||
| c823ce1946 | |||
| 2fa15f772a | |||
| 02b6d54cc9 | |||
| 8bb3474c05 | |||
| 7e904cdbe7 | |||
| e46b4977a4 | |||
| 5de2e0b96e |
@@ -5,12 +5,12 @@
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-elasticsearch</artifactId>
|
||||
<version>4.4.3</version>
|
||||
<version>4.4.4</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>2.7.3</version>
|
||||
<version>2.7.4</version>
|
||||
</parent>
|
||||
|
||||
<name>Spring Data Elasticsearch</name>
|
||||
@@ -24,7 +24,7 @@
|
||||
<elasticsearch-java>7.17.6</elasticsearch-java>
|
||||
<log4j>2.17.1</log4j>
|
||||
<netty>4.1.65.Final</netty>
|
||||
<springdata.commons>2.7.3</springdata.commons>
|
||||
<springdata.commons>2.7.4</springdata.commons>
|
||||
<testcontainers>1.16.2</testcontainers>
|
||||
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
|
||||
<java-module-name>spring.data.elasticsearch</java-module-name>
|
||||
|
||||
+9
@@ -256,6 +256,15 @@ public interface WebClientProvider {
|
||||
HttpHeaders suppliedHeaders = clientConfiguration.getHeadersSupplier().get();
|
||||
|
||||
if (suppliedHeaders != null && suppliedHeaders != HttpHeaders.EMPTY) {
|
||||
|
||||
// remove content-type and accept if they are provided by the client configuration (ES7 compatibility headers)
|
||||
if (suppliedHeaders.containsKey(HttpHeaders.CONTENT_TYPE)) {
|
||||
httpHeaders.remove(HttpHeaders.CONTENT_TYPE);
|
||||
}
|
||||
if (suppliedHeaders.containsKey(HttpHeaders.ACCEPT)) {
|
||||
httpHeaders.remove(HttpHeaders.ACCEPT);
|
||||
}
|
||||
|
||||
httpHeaders.addAll(suppliedHeaders);
|
||||
}
|
||||
}));
|
||||
|
||||
+5
-2
@@ -46,7 +46,11 @@ final public class StringQueryUtil {
|
||||
|
||||
String placeholder = Pattern.quote(matcher.group()) + "(?!\\d+)";
|
||||
int index = NumberUtils.parseNumber(matcher.group(1), Integer.class);
|
||||
result = result.replaceAll(placeholder, Matcher.quoteReplacement(getParameterWithIndex(accessor, index)));
|
||||
String replacement = Matcher.quoteReplacement(getParameterWithIndex(accessor, index));
|
||||
result = result.replaceAll(placeholder, replacement);
|
||||
// need to escape backslashes that are not escapes for quotes so that they are sent as double-backslashes
|
||||
// to Elasticsearch
|
||||
result = result.replaceAll("\\\\([^\"'])", "\\\\\\\\$1");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -56,7 +60,6 @@ final public class StringQueryUtil {
|
||||
Object parameter = accessor.getBindableValue(index);
|
||||
String parameterValue = "null";
|
||||
|
||||
// noinspection ConstantConditions
|
||||
if (parameter != null) {
|
||||
|
||||
parameterValue = convert(parameter);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Spring Data Elasticsearch 4.4.3 (2021.2.3)
|
||||
Spring Data Elasticsearch 4.4.4 (2021.2.4)
|
||||
Copyright (c) [2013-2021] Pivotal Software, Inc.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
@@ -39,5 +39,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+12
@@ -129,6 +129,18 @@ public class ElasticsearchStringQueryUnitTests extends ElasticsearchStringQueryU
|
||||
"{ 'bool' : { 'must' : { 'terms' : { 'name' : [\"hello \\\"Stranger\\\"\",\"Another string\"] } } } }");
|
||||
}
|
||||
|
||||
@Test // #2326
|
||||
@DisplayName("should escape backslashes in collection query parameters")
|
||||
void shouldEscapeBackslashesInCollectionQueryParameters() throws NoSuchMethodException {
|
||||
|
||||
final List<String> parameters = Arrays.asList("param\\1", "param\\2");
|
||||
List<String> params = new ArrayList<>(parameters);
|
||||
org.springframework.data.elasticsearch.core.query.Query query = createQuery("findByNameIn", params);
|
||||
|
||||
assertThat(query).isInstanceOf(StringQuery.class);
|
||||
assertThat(((StringQuery) query).getSource()).isEqualTo(
|
||||
"{ 'bool' : { 'must' : { 'terms' : { 'name' : [\"param\\\\1\",\"param\\\\2\"] } } } }");
|
||||
}
|
||||
private org.springframework.data.elasticsearch.core.query.Query createQuery(String methodName, Object... args)
|
||||
throws NoSuchMethodException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user