public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] utils: custom check: fix error in spamscore regex
@ 2024-06-18 15:30 Stoiko Ivanov
  0 siblings, 0 replies; only message in thread
From: Stoiko Ivanov @ 2024-06-18 15:30 UTC (permalink / raw)
  To: pmg-devel

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@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



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-18 15:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-18 15:30 [pmg-devel] [PATCH pmg-api] utils: custom check: fix error in spamscore regex Stoiko Ivanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal