[pmg-devel] [PATCH pmg-api] improve pmg-email-address regex

Dominik Csapak d.csapak at proxmox.com
Mon Feb 18 17:12:10 CET 2019


the '|' is not necessary since the first option is empty (mitigated by
the minLength of 3) and add the '\' to forbidden characters since
they make problems with browser requests (browsers convert '\' to '/')

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PMG/Utils.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PMG/Utils.pm b/PMG/Utils.pm
index 26c0921..60fdc5e 100644
--- a/PMG/Utils.pm
+++ b/PMG/Utils.pm
@@ -108,7 +108,7 @@ PVE::JSONSchema::register_standard_option('username', {
 PVE::JSONSchema::register_standard_option('pmg-email-address', {
     description => "Email Address (allow most characters).",
     type => 'string',
-    pattern => '(?:|[^\s\/\@]+\@[^\s\/\@]+)',
+    pattern => '(?:[^\s\/\\\@]+\@[^\s\/\\\@]+)',
     maxLength => 512,
     minLength => 3,
 });
-- 
2.11.0




More information about the pmg-devel mailing list