mirror of
https://github.com/nextcloud/passman.git
synced 2025-02-26 00:14:44 +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]);
|
var fieldValue = (typeof c[field] === 'string') ? c[field] : JSON.stringify(c[field]);
|
||||||
|
|
||||||
if (filter.hasOwnProperty('useRegex') && filter.useRegex === true) {
|
if (filter.hasOwnProperty('useRegex') && filter.useRegex === true) {
|
||||||
var patt;
|
try {
|
||||||
patt = new RegExp(filter.filterText);
|
var patt = new RegExp(filter.filterText);
|
||||||
if (patt.test(fieldValue)) {
|
if (patt.test(fieldValue)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
} catch (e){
|
||||||
|
// Don't catch regex errors.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue