String dropdowns prioritize capitalization over starting with
kevinthegreat1 opened this issue ยท 0 comments
Options containing the correct capitalization can be prioritized over options that starts with the string.
Example
Analysis
In AbstractDropdownController#getValidValue
, the filter calls value.toLowerCase()
but the checks in sorted()
does not call toLowerCase()
.
return getAllowedValues(value).stream()
.filter(val -> val.toLowerCase().contains(value.toLowerCase()))
.sorted((s1, s2) -> {
if (s1.startsWith(value) && !s2.startsWith(value)) return -1;
if (!s1.startsWith(value) && s2.startsWith(value)) return 1;
return s1.compareTo(s2);
})
.skip(offset)
.findFirst()
.orElseGet(this::getString);