From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id BA1F320EC88 for ; Thu, 25 Apr 2024 11:00:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B50671DBD1; Thu, 25 Apr 2024 11:00:13 +0200 (CEST) From: Lukas Wagner To: pbs-devel@lists.proxmox.com Date: Thu, 25 Apr 2024 10:59:36 +0200 Message-Id: <20240425085936.125328-1-l.wagner@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup] ui: sync job: fix error if local namespace is selected first X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" When creating a new sync job and a local namespace is configured without setting a remote first, the createMaxPrefixLength was passed an array instead of a string/undefined/null, which triggered a 'ns2.match is not a funtion exception', making the UI glitchy afterwards. Fixed by explicitly checking for a string. Verified that the other user of NamespaceMaxDepthReduced, the prune job edit window, does not break after the change. Signed-off-by: Lukas Wagner --- www/form/NamespaceMaxDepth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/form/NamespaceMaxDepth.js b/www/form/NamespaceMaxDepth.js index cfe80de0..64f8d512 100644 --- a/www/form/NamespaceMaxDepth.js +++ b/www/form/NamespaceMaxDepth.js @@ -37,10 +37,10 @@ Ext.define('PBS.form.NamespaceMaxDepthReduced', { calcMaxPrefixLength: function(ns1, ns2) { let maxPrefixLength = 0; - if (ns1 !== undefined && ns1 !== null) { + if (ns1 !== undefined && ns1 !== null && typeof ns1 === 'string') { maxPrefixLength = (ns1.match(/[/]/g) || []).length + (ns1 === '' ? 0 : 1); } - if (ns2 !== undefined && ns2 !== null) { + if (ns2 !== undefined && ns2 !== null && typeof ns2 === 'string') { let ns2PrefixLength = (ns2.match(/[/]/g) || []).length + (ns2 === '' ? 0 : 1); if (ns2PrefixLength > maxPrefixLength) { maxPrefixLength = ns2PrefixLength; -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel