mirror of
https://github.com/nextcloud/passman.git
synced 2025-02-25 16:04:19 +08:00
Catch regex errors
This commit is contained in:
parent
4b569607f4
commit
5a6099632c
1 changed files with 7 additions and 4 deletions
|
@ -47,10 +47,13 @@
|
|||
var fieldValue = (typeof c[field] === 'string') ? c[field] : JSON.stringify(c[field]);
|
||||
|
||||
if (filter.hasOwnProperty('useRegex') && filter.useRegex === true) {
|
||||
var patt;
|
||||
patt = new RegExp(filter.filterText);
|
||||
if (patt.test(fieldValue)) {
|
||||
return true;
|
||||
try {
|
||||
var patt = new RegExp(filter.filterText);
|
||||
if (patt.test(fieldValue)) {
|
||||
return true;
|
||||
}
|
||||
} catch (e){
|
||||
// Don't catch regex errors.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue