all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] ui: sync job: fix error if local namespace is selected first
@ 2024-04-25  8:59 Lukas Wagner
  2024-04-25  9:53 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wagner @ 2024-04-25  8:59 UTC (permalink / raw)
  To: 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 <l.wagner@proxmox.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-25  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25  8:59 [pbs-devel] [PATCH proxmox-backup] ui: sync job: fix error if local namespace is selected first Lukas Wagner
2024-04-25  9:53 ` [pbs-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal