1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

fix: Use knex whereLike instead of whereRaw to fix escaping (#6041)

This escape with `??` double escaped the LIKE query causing no results.
This updates to using whereLike, which does the correct escaping for
string query.
This commit is contained in:
Christopher Kolstad 2024-01-26 10:44:53 +01:00 committed by GitHub
parent 32484460ef
commit 32dd377c3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,10 +167,11 @@ export default class ClientInstanceStore implements IClientInstanceStore {
}
async getBySdkName(sdkName: string): Promise<IClientInstance[]> {
const sdkPrefix = `${sdkName}%`;
const rows = await this.db
.select()
.from(TABLE)
.whereRaw(`sdk_version LIKE '??%'`, [sdkName])
.whereLike('sdk_version', sdkPrefix)
.orderBy('last_seen', 'desc');
return rows.map(mapRow);
}