From c56c43c46481ba0eb3a96c8b115a2043d58c22d3 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Sat, 8 May 2021 17:18:26 -0700 Subject: [PATCH] app backup filename now has fqdn Part of cloudron/box#782 --- src/views/backups.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/views/backups.js b/src/views/backups.js index 805340917..26256bedf 100644 --- a/src/views/backups.js +++ b/src/views/backups.js @@ -659,15 +659,22 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat $scope.backups = $scope.backups.slice(0, 20); // only show 20 since we don't have pagination // add contents property - var appsById = {}; - Client.getInstalledApps().forEach(function (app) { appsById[app.id] = app; }); + var appsById = {}, appsByFqdn = {}; + Client.getInstalledApps().forEach(function (app) { + appsById[app.id] = app; + appsByFqdn[app.fqdn] = app; + }); $scope.backups.forEach(function (backup) { backup.contents = []; backup.dependsOn.forEach(function (appBackupId) { let match = appBackupId.match(/app_(.*?)_.*/); // *? means non-greedy - if (!match || !appsById[match[1]]) return; - backup.contents.push(appsById[match[1]]); + if (!match) return; + if (match[1].indexOf('.') !== -1) { // newer backups have fqdn in them + if (appsByFqdn[match[1]]) backup.contents.push(appsByFqdn[match[1]]); + } else { + if (appsById[match[1]]) backup.contents.push(appsById[match[1]]); + } }); }); });