Browse Source

fix: skip trimming options while applying filter (#9542)

pull/9544/head
Pranav C 2 months ago committed by GitHub
parent
commit
4776eaaa18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      packages/nocodb/src/db/conditionV2.ts

9
packages/nocodb/src/db/conditionV2.ts

@ -927,7 +927,14 @@ const parseConditionV2 = async (
{ {
// Condition for filter, without negation // Condition for filter, without negation
const condition = (builder: Knex.QueryBuilder) => { const condition = (builder: Knex.QueryBuilder) => {
const items = val?.split(',').map((item) => item.trim()); let items = val?.split(',');
// remove trailing space if database is MySQL and datatype is enum/set
if (
['mysql2', 'mysql'].includes(knex.clientType()) &&
['enum', 'set'].includes(column.dt?.toLowerCase())
) {
items = items.map((item) => item.trimEnd());
}
for (let i = 0; i < items?.length; i++) { for (let i = 0; i < items?.length; i++) {
let sql; let sql;
const bindings = [field, `%,${items[i]},%`]; const bindings = [field, `%,${items[i]},%`];

Loading…
Cancel
Save