Skip to content

Commit 50530d9

Browse files
committed
GH-2681 - Sanitize label replacements.
This requires an update of the CypherDSL to use the built-in function instead of copying code.
1 parent 216952a commit 50530d9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/springframework/data/neo4j/repository/query/Neo4jSpelSupport.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import org.apache.commons.logging.LogFactory;
2828
import org.apiguardian.api.API;
29+
import org.neo4j.cypherdsl.core.internal.SchemaNames;
2930
import org.springframework.core.log.LogAccessor;
3031
import org.springframework.data.domain.Pageable;
3132
import org.springframework.data.domain.Sort;
@@ -111,7 +112,9 @@ private static LiteralReplacement labels(@Nullable Object arg, String joinOn) {
111112

112113
private static String joinStrings(Object arg, String joinOn) {
113114
if (arg instanceof Collection) {
114-
return ((Collection<?>) arg).stream().map(Object::toString).collect(Collectors.joining(joinOn));
115+
return ((Collection<?>) arg).stream()
116+
.map(o -> SchemaNames.sanitize(o.toString()).get())
117+
.collect(Collectors.joining(joinOn));
115118
}
116119

117120
// we are so kind and also accept plain strings instead of collection<string>

0 commit comments

Comments
 (0)