[pve-devel] [PATCH v2 guest-common 5/8] vzdump: mailto: use email-or-username-list format

Fabian Ebner f.ebner at proxmox.com
Mon Feb 15 13:24:59 CET 2021


because it is a more complete pattern. Also, 'mailto' was a '-list' format in
PVE 6.2 and earlier, so this also fixes whitespace-related backwards
compatibility. In particular, this fixes creating a backup job in the GUI
without setting an address, which passes along ''.

For example,
> vzdump 153 --mailto " ,,,admin at proxmox.com;;; developer at proxmox.com , ; "
was valid and worked in PVE 6.2.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Changes from v1:
    * re-use the more complete pattern from pve-common

Dependency bump for pve-common is needed.

 PVE/VZDump/Common.pm | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/PVE/VZDump/Common.pm b/PVE/VZDump/Common.pm
index 5d93b51..86cb7bd 100644
--- a/PVE/VZDump/Common.pm
+++ b/PVE/VZDump/Common.pm
@@ -71,9 +71,6 @@ sub parse_dow {
     return $res;
 };
 
-my $mailto_pattern = '[a-zA-Z0-9+._@][-a-zA-Z0-9+._@]*';
-my $mailto_list_pattern = "($mailto_pattern)([;,]$mailto_pattern)*";
-
 my $confdesc = {
     vmid => {
 	type => 'string', format => 'pve-vmid-list',
@@ -146,8 +143,7 @@ my $confdesc = {
     },
     mailto => {
 	type => 'string',
-	pattern => $mailto_list_pattern,
-	format_description => 'email-or-username-list',
+	format => 'email-or-username-list',
 	description => "Comma-separated list of email addresses or users that should" .
 	    " receive email notifications.",
 	optional => 1,
-- 
2.20.1





More information about the pve-devel mailing list