ui: Parser: fix bind and dev mounts for lxc

match returns 'null' if the regex does not match, which is not
destructurable. so we have to save the match and check if it valid

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-05-20 16:59:14 +02:00 committed by Thomas Lamprecht
parent 3f7d054ee1
commit 308d9f365c

View File

@ -367,9 +367,9 @@ Ext.define('PVE.Parser', {
return undefined;
}
const [, storage] = res.file.match(/^([a-z][a-z0-9\-_.]*[a-z0-9]):/i);
if (storage) {
res.storage = storage;
const match = res.file.match(/^([a-z][a-z0-9\-_.]*[a-z0-9]):/i);
if (match) {
res.storage = match[1];
res.type = 'volume';
} else if (res.file.match(/^\/dev\//)) {
res.type = 'device';