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>
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';