Browse Source

fix: binding in hm & bt

pull/2424/head
Wing-Kam Wong 2 years ago
parent
commit
44f9fdeb7c
  1. 10
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

10
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -41,6 +41,7 @@ import { customValidators } from './customValidators';
import { NcError } from '../../../../meta/helpers/catchError'; import { NcError } from '../../../../meta/helpers/catchError';
import { customAlphabet } from 'nanoid'; import { customAlphabet } from 'nanoid';
import DOMPurify from 'isomorphic-dompurify'; import DOMPurify from 'isomorphic-dompurify';
import { sanitize, unsanitize } from './helpers/sanitize';
const GROUP_COL = '__nc_group_id'; const GROUP_COL = '__nc_group_id';
@ -907,7 +908,7 @@ class BaseModelSqlv2 {
const proto = await childModel.getProto(); const proto = await childModel.getProto();
return (await qb).map(c => { return (await this.dbDriver.raw(unsanitize(qb.toQuery())))[0].map(c => {
c.__proto__ = proto; c.__proto__ = proto;
return c; return c;
}); });
@ -993,8 +994,7 @@ class BaseModelSqlv2 {
applyPaginate(qb, args); applyPaginate(qb, args);
const proto = await parentModel.getProto(); const proto = await parentModel.getProto();
return (await this.dbDriver.raw(unsanitize(qb.toQuery())))[0].map(c => {
return (await qb).map(c => {
c.__proto__ = proto; c.__proto__ = proto;
return c; return c;
}); });
@ -2167,10 +2167,6 @@ function getCompositePk(primaryKeys: Column[], row) {
return primaryKeys.map(c => row[c.title]).join('___'); return primaryKeys.map(c => row[c.title]).join('___');
} }
export function sanitize(v) {
return v?.replaceAll('?', '\\\\?');
}
export { BaseModelSqlv2 }; export { BaseModelSqlv2 };
/** /**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd * @copyright Copyright (c) 2021, Xgene Cloud Ltd

Loading…
Cancel
Save