QuerydslPredicateBuilder#getPredicate uses a function called isSingleElementCollectionWithoutText to filter out all single element collection values that are null/empty string/string with nothing but whitespace.
Sometimes you do want to use values that are just an empty string or a string with nothing but whitespaces.
One workaround is to add the same value twice, so it's not regarded as a single element collection. In this case, the value doesn't get filtered out.
For example, when using the QueryDSL Web Support, GETting "/notes?name=%20" will end up returning all notes since "name= " gets dropped by QuerydslPredicateBuilder#isSingleElementCollectionWithoutText.
"/notes?name=%20&name=%20" will end up returning only the notes with " " as name
spring-projects-issues commentedDec 10, 2018
SanderKleykens opened DATACMNS-1443 and commented
QuerydslPredicateBuilder#getPredicate uses a function called isSingleElementCollectionWithoutText to filter out all single element collection values that are null/empty string/string with nothing but whitespace.
Sometimes you do want to use values that are just an empty string or a string with nothing but whitespaces.
One workaround is to add the same value twice, so it's not regarded as a single element collection. In this case, the value doesn't get filtered out.
For example, when using the QueryDSL Web Support, GETting "/notes?name=%20" will end up returning all notes since "name= " gets dropped by QuerydslPredicateBuilder#isSingleElementCollectionWithoutText.
"/notes?name=%20&name=%20" will end up returning only the notes with " " as name
Affects: 2.0.12 (Kay SR12), 1.13.17 (Ingalls SR17), 2.1.3 (Lovelace SR3)
Referenced from: commits d75ab30, f2967a9, 296d105, 0609f47
Backported to: 2.1.4 (Lovelace SR4), 2.0.13 (Kay SR13), 1.13.18 (Ingalls SR18)
The text was updated successfully, but these errors were encountered: