From b40a10da7b00a1df45cff5d9096f6b50f1197290 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 27 Mar 2026 18:47:49 +0100 Subject: [PATCH] restore: prune portBindings whose tcpPorts/udpPorts no longer exist fixes #871 --- src/apps.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/apps.js b/src/apps.js index e6fcb3c78..d4eb14322 100644 --- a/src/apps.js +++ b/src/apps.js @@ -2506,6 +2506,15 @@ async function restore(app, backupId, auditSource) { const newHttpPorts = manifest.httpPorts || {}; values.secondaryDomains = app.secondaryDomains.filter(sd => sd.environmentVariable in newHttpPorts); + // prune portBindings whose tcpPorts/udpPorts no longer exist in the restored manifest + const newTcpPorts = manifest.tcpPorts || {}; + const newUdpPorts = manifest.udpPorts || {}; + const portBindings = {}; + for (const portName in app.portBindings) { + if (portName in newTcpPorts || portName in newUdpPorts) portBindings[portName] = app.portBindings[portName]; + } + values.portBindings = portBindings; + const restoreConfig = { backupId: restoreBackup.id }; const task = {