mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-04-29 22:45:19 +00:00
ui: sync job: fix error if local namespace is selected first
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>
This commit is contained in:
parent
5e12ca4ce7
commit
eff279e771
@ -37,10 +37,10 @@ Ext.define('PBS.form.NamespaceMaxDepthReduced', {
|
|||||||
|
|
||||||
calcMaxPrefixLength: function(ns1, ns2) {
|
calcMaxPrefixLength: function(ns1, ns2) {
|
||||||
let maxPrefixLength = 0;
|
let maxPrefixLength = 0;
|
||||||
if (ns1 !== undefined && ns1 !== null) {
|
if (ns1 !== undefined && ns1 !== null && typeof ns1 === 'string') {
|
||||||
maxPrefixLength = (ns1.match(/[/]/g) || []).length + (ns1 === '' ? 0 : 1);
|
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);
|
let ns2PrefixLength = (ns2.match(/[/]/g) || []).length + (ns2 === '' ? 0 : 1);
|
||||||
if (ns2PrefixLength > maxPrefixLength) {
|
if (ns2PrefixLength > maxPrefixLength) {
|
||||||
maxPrefixLength = ns2PrefixLength;
|
maxPrefixLength = ns2PrefixLength;
|
||||||
|
Loading…
Reference in New Issue
Block a user