From 957284edb8666cfec0082967fcdb51c17573e608 Mon Sep 17 00:00:00 2001 From: Gerrit Meier Date: Tue, 28 Feb 2023 14:17:21 +0100 Subject: [PATCH] GH-2681 - Sanitize label replacements. This requires an update of the CypherDSL to use the built-in function instead of copying code. --- .../data/neo4j/repository/query/Neo4jSpelSupport.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/springframework/data/neo4j/repository/query/Neo4jSpelSupport.java b/src/main/java/org/springframework/data/neo4j/repository/query/Neo4jSpelSupport.java index 35b279d4b..99ebcec8a 100644 --- a/src/main/java/org/springframework/data/neo4j/repository/query/Neo4jSpelSupport.java +++ b/src/main/java/org/springframework/data/neo4j/repository/query/Neo4jSpelSupport.java @@ -26,6 +26,7 @@ import java.util.stream.Collectors; import org.apache.commons.logging.LogFactory; import org.apiguardian.api.API; +import org.neo4j.cypherdsl.core.internal.SchemaNames; import org.springframework.core.log.LogAccessor; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; @@ -111,7 +112,9 @@ public final class Neo4jSpelSupport { private static String joinStrings(Object arg, String joinOn) { if (arg instanceof Collection) { - return ((Collection) arg).stream().map(Object::toString).collect(Collectors.joining(joinOn)); + return ((Collection) arg).stream() + .map(o -> SchemaNames.sanitize(o.toString()).get()) + .collect(Collectors.joining(joinOn)); } // we are so kind and also accept plain strings instead of collection