[pve-devel] [PATCH manager 1/3] ui: Parser: fix bind and dev mounts for lxc

Dominik Csapak d.csapak at proxmox.com
Thu May 20 16:59:14 CEST 2021


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 at proxmox.com>
---
 www/manager6/Parser.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/www/manager6/Parser.js b/www/manager6/Parser.js
index 1db82331..bb6a9a33 100644
--- a/www/manager6/Parser.js
+++ b/www/manager6/Parser.js
@@ -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';
-- 
2.20.1





More information about the pve-devel mailing list