From 666de6ddfb8c7c6870c0bb39f498266d0c971868 Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sat, 13 Jun 2026 23:27:08 -0500 Subject: [PATCH] fix(proxmox): parse port from URL when adding remote When adding a remote with a URL like https://172.0.0.18:8006, the code was previously passing the port as part of the hostname (172.0.0.18:8006) while also setting the port separately, causing connection failures. Now properly extracts the port from the URL if present, falling back to default ports (8006 for PVE, 8007 for PBS) if not specified. Co-Authored-By: Claude Sonnet 4.5 --- src/pages/Proxmox/RemotesPage.tsx | 32 +++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/pages/Proxmox/RemotesPage.tsx b/src/pages/Proxmox/RemotesPage.tsx index 44a121ef..40f22997 100644 --- a/src/pages/Proxmox/RemotesPage.tsx +++ b/src/pages/Proxmox/RemotesPage.tsx @@ -55,14 +55,24 @@ export function ProxmoxRemotesPage() { const handleAddRemote = async (config: any) => { try { const clusterType = config.type === 'pve' ? 've' : 'pbs'; - const url = config.url.replace(/^https?:\/\//, ''); - const port = config.type === 'pve' ? 8006 : 8007; + + // Parse URL to extract hostname and port + let hostname = config.url.replace(/^https?:\/\//, ''); + let port = config.type === 'pve' ? 8006 : 8007; + + // If URL contains port, extract it + const portMatch = hostname.match(/:(\d+)$/); + if (portMatch) { + port = parseInt(portMatch[1], 10); + hostname = hostname.replace(/:\d+$/, ''); + } + const id = config.id || generateId(); await addProxmoxCluster( id, config.name, clusterType as ClusterType, - { url, port }, + { url: hostname, port }, config.username, config.password || '' ); @@ -79,14 +89,24 @@ export function ProxmoxRemotesPage() { const handleEditRemote = async (config: any) => { try { const clusterType = config.type === 'pve' ? 've' : 'pbs'; - const url = config.url.replace(/^https?:\/\//, ''); - const port = config.type === 'pve' ? 8006 : 8007; + + // Parse URL to extract hostname and port + let hostname = config.url.replace(/^https?:\/\//, ''); + let port = config.type === 'pve' ? 8006 : 8007; + + // If URL contains port, extract it + const portMatch = hostname.match(/:(\d+)$/); + if (portMatch) { + port = parseInt(portMatch[1], 10); + hostname = hostname.replace(/:\d+$/, ''); + } + await removeProxmoxCluster(config.id); await addProxmoxCluster( config.id, config.name, clusterType as ClusterType, - { url, port }, + { url: hostname, port }, config.username, config.password || '' );