Skip to content

Commit 40d2ea3

Browse files
committed
Fix broken backslash search πŸŽ‰
1 parent feb7a91 commit 40d2ea3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

β€Žsrc/components/basic_table/in_memory_table.test.tsxβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,8 @@ describe('EuiInMemoryTable', () => {
14401440

14411441
describe('text search format', () => {
14421442
it('allows searching for any text with special characters in it', () => {
1443-
const specialCharacterSearch = '!@#$%^&*(){}+=-_hello:world"`<>?/πŸ‘‹~.,;|';
1443+
const specialCharacterSearch =
1444+
'!@#$%^&*(){}+=-_hello:world"`<>?/πŸ‘‹~.,;|\\';
14441445
const items = [
14451446
{ title: specialCharacterSearch },
14461447
{ title: 'no special characters' },

β€Žsrc/components/basic_table/in_memory_table.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ export class EuiInMemoryTable<T> extends Component<
541541
// Alternative to onQueryChange - allows consumers to specify they want the
542542
// search bar to ignore EQL syntax and only use the searchbar for plain text
543543
onPlainTextSearch = (searchValue: string) => {
544-
const escapedQueryText = searchValue.replaceAll('"', '\\"');
544+
const escapedQueryText = searchValue.replace(/["\\]/g, '\\$&');
545545
const finalQuery = `"${escapedQueryText}"`;
546546
this.setState({
547547
query: EuiSearchBar.Query.parse(finalQuery),

0 commit comments

Comments
Β (0)