www: fix acme parser

not yet for the new features/keys, but the old one was broken already..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2020-04-17 08:09:54 +02:00 committed by Thomas Lamprecht
parent 922f7b07f4
commit 08a61c7b30

View 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;
},