[pmg-devel] [PATCH pmg-api] utils: custom check: fix error in spamscore regex
Stoiko Ivanov
s.ivanov at proxmox.com
Tue Jun 18 17:30:15 CEST 2024
Currently a reply with a negative spam-score with fractional part like:
v1
SCORE: -1.52
yields an error (as the optional '-' is only accepted as part of the
first alternative.
quickly tested with a very minimal custom-checkscript (that returns
the output above).
reported in our community forum:
https://forum.proxmox.com/threads/.148927/#post-675209
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
src/PMG/Utils.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index 5d9ded4..b91d697 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -383,7 +383,7 @@ sub analyze_custom_check {
$customcheck_output_apiver = $line;
die "api version mismatch - expected $customcheck_apiver, got $customcheck_output_apiver !\n"
if ($customcheck_output_apiver ne $customcheck_apiver);
- } elsif ($line =~ /^SCORE: (-?[0-9]+|.[0-9]+|[0-9]+.[0-9]+)$/) {
+ } elsif ($line =~ /^SCORE: (-?(?:[0-9]+|.[0-9]+|[0-9]+.[0-9]+))$/) {
$spam_score = $1;
$result_flag = 1;
} elsif ($line =~ /^VIRUS: (.+)$/) {
--
2.39.2
More information about the pmg-devel
mailing list