update pg search sanitize list (#31083)

Signed-off-by: Vladimir Kobzev <vkobzev@bol.com>
This commit is contained in:
yu-kkurii
2025-09-22 21:37:29 +02:00
committed by GitHub
parent d06cadc612
commit 8d15a51b3e
3 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-search-backend-module-pg': patch
---
Added the < character to the query filter regexp
@@ -133,7 +133,7 @@ describe('PgSearchEngine', () => {
it('should sanitize query term', async () => {
const actualTranslatedQuery = searchEngine.translator(
{
term: 'H&e|l!l*o W\0o(r)l:d',
term: 'H&e|l!l*o < W\0o(r)l:d',
pageCursor: '',
},
{ highlightOptions },
@@ -196,7 +196,7 @@ export class PgSearchEngine implements SearchEngine {
pgQuery: {
pgTerm: query.term
.split(/\s/)
.map(p => p.replace(/[\0()|&:*!]/g, '').trim())
.map(p => p.replace(/[\0()|&:*!<]/g, '').trim())
.filter(p => p !== '')
.map(p => `(${JSON.stringify(p)} | ${JSON.stringify(p)}:*)`)
.join('&'),