[pmg-devel] [PATCH pmg-api] make API/regextest match case-insensitive
Stoiko Ivanov
s.ivanov at proxmox.com
Thu May 28 13:03:09 CEST 2020
The regext test api route is used when editing the following objects in the
rulesystem:
* WhoRegex
* MatchField
* MatchFilename
* MatchArchiveFilename
(list compiled by grepping (-i) for regextest in pmg-gui)
all of those objects are matched case-insensitively when a mail is processed
so the testing should also match case-insensitively.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
reported in our community forum:
https://forum.proxmox.com/threads/mail-proxy-transport-relay-domain-same-domain-sending-filtering-email-from-two-different-servers-ip-addresses.70455/
src/PMG/API2/Config.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PMG/API2/Config.pm b/src/PMG/API2/Config.pm
index 1b3743e..d4a9679 100644
--- a/src/PMG/API2/Config.pm
+++ b/src/PMG/API2/Config.pm
@@ -227,7 +227,7 @@ __PACKAGE__->register_method({
method => 'POST',
protected => 0,
permissions => { check => [ 'admin', 'qmanager', 'audit' ] },
- description => "Test Regex",
+ description => "Test Regex ignoring case",
parameters => {
additionalProperties => 0,
properties => {
@@ -255,7 +255,7 @@ __PACKAGE__->register_method({
my $regex_check = sub {
my $start_time = [Time::HiRes::gettimeofday];
my $match = 0;
- if ($text =~ /$regex/) {
+ if ($text =~ /$regex/i) {
$match = 1;
}
my $elapsed = Time::HiRes::tv_interval($start_time) * 1000;
--
2.20.1
More information about the pmg-devel
mailing list