]> git.proxmox.com Git - pve-manager.git/commitdiff
www: fix acme parser
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 17 Apr 2020 06:09:54 +0000 (08:09 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 3 May 2020 12:10:17 +0000 (14:10 +0200)
not yet for the new features/keys, but the old one was broken already..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
www/manager6/Parser.js

index 0790e683dcb81306f254c1478a47fea018ceda32..43cc4f5f9c77cffd09e86ad09dc2a977c500e3d2 100644 (file)
@@ -11,26 +11,27 @@ Ext.define('PVE.Parser', { statics: {
        }
 
        var res = {};
-       var errors = false;
+       var error;
 
        Ext.Array.each(value.split(','), function(p) {
-           if (!p || p.match(/^\s*$/)) {
-               return; //continue
-           }
-
-           var match_res;
-           if ((match_res = p.match(/^(?:domains=)?((?:[a-zA-Z0-9\-\.]+[;, ]?)+)$/)) !== null) {
-               res.domains = match_res[1].split(/[;, ]/);
+           var kv = p.split('=', 2);
+           if (Ext.isDefined(kv[1])) {
+               res[kv[0]] = kv[1];
            } else {
-               errors = true;
+               error = 'Failed to parse key-value pair: '+p;
                return false;
            }
        });
 
-       if (errors || !res) {
+       if (error !== undefined) {
+           console.error(error);
            return;
        }
 
+       if (res.domains !== undefined) {
+           res.domains = res.domains.split(/;/);
+       }
+
        return res;
     },