Open tabs menu: Escape regex special characters

So we don't throw an error/match inappropriately when the filter
contains backslashes, periods, pluses, and so on.
This commit is contained in:
Abe Jellinek 2024-01-24 14:59:46 -05:00 committed by Dan Stillman
parent a1134255ee
commit 873c87956c

View file

@ -789,7 +789,7 @@ var Zotero_Tabs = new function () {
let xhtmlNS = "http://www.w3.org/1999/xhtml";
let desc = document.createXULElement('description');
let regex = new RegExp(`(${this._tabsMenuFilter})`, 'gi');
let regex = new RegExp(`(${Zotero.Utilities.quotemeta(this._tabsMenuFilter)})`, 'gi');
let matches = title.matchAll(regex);
let lastIndex = 0;