Don't use RegExp for tag filter (Reactification regression)
Using a regexp meant that an invalid regexp pattern would crash the tag selector, and even if we caught that it would produce unexpected results for some searches (e.g., anything with a period).
This commit is contained in:
parent
42667e7090
commit
62ea7e970a
1 changed files with 2 additions and 1 deletions
|
@ -170,7 +170,8 @@ Zotero.TagSelector = class TagSelectorContainer extends React.Component {
|
|||
tags = Array.from(new Set(tags.map(t => t.tag)));
|
||||
}
|
||||
if (this.state.searchString) {
|
||||
tags = tags.filter(tag => !!tag.match(new RegExp(this.state.searchString, 'i')));
|
||||
let lcStr = this.state.searchString.toLowerCase();
|
||||
tags = tags.filter(tag => tag.toLowerCase().startsWith(lcStr));
|
||||
}
|
||||
tags = tags.map((name) => {
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue