public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] ui: sync job: fix error if local namespace is selected first
Date: Thu, 25 Apr 2024 10:59:36 +0200	[thread overview]
Message-ID: <20240425085936.125328-1-l.wagner@proxmox.com> (raw)

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


             reply	other threads:[~2024-04-25  9:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25  8:59 Lukas Wagner [this message]
2024-04-25  9:53 ` [pbs-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240425085936.125328-1-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal