You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Don't try to match with an empty query string
This was causing UserProvider to give results because every string happens to start with empty string and its regex also acepts the empty string.
This commit is contained in:
@@ -86,6 +86,9 @@ export default class QueryMatcher {
|
|||||||
if (this.options.shouldMatchWordsOnly) {
|
if (this.options.shouldMatchWordsOnly) {
|
||||||
query = query.replace(/[^\w]/g, '');
|
query = query.replace(/[^\w]/g, '');
|
||||||
}
|
}
|
||||||
|
if (query.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
const results = [];
|
const results = [];
|
||||||
this.keyMap.keys.forEach((key) => {
|
this.keyMap.keys.forEach((key) => {
|
||||||
let resultKey = key.toLowerCase();
|
let resultKey = key.toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user