Escape colons in Lunr search query filters

Signed-off-by: Jesse Bye <jbye@riskalyze.com>
This commit is contained in:
Jesse Bye
2021-06-17 13:50:59 -07:00
committed by blam
parent e30ffe2225
commit 7e7cec86ac
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-search-backend-node': patch
---
Escape : characters in the query
@@ -57,6 +57,9 @@ export class LunrSearchEngine implements SearchEngine {
.map(([field, value]) => {
// Require that the given field has the given value (with +).
if (['string', 'number', 'boolean'].includes(typeof value)) {
if (typeof value === 'string') {
return ` +${field}:${value.replace(':', '\\:')}`;
}
return ` +${field}:${value}`;
}