archive: appConfig is null for pre-8.2 backups

use backups.manifest when possible instead
This commit is contained in:
Girish Ramakrishnan
2024-12-19 14:21:39 +01:00
parent 40abb446d4
commit cd8be9ffb5
5 changed files with 41 additions and 22 deletions
+4 -1
View File
@@ -17,7 +17,7 @@ const assert = require('assert'),
safe = require('safetydance'),
uuid = require('uuid');
const ARCHIVE_FIELDS = [ 'archives.id', 'backupId', 'archives.creationTime', 'backups.remotePath', 'backups.appConfigJson', '(archives.icon IS NOT NULL) AS hasIcon', '(archives.appStoreIcon IS NOT NULL) AS hasAppStoreIcon' ];
const ARCHIVE_FIELDS = [ 'archives.id', 'backupId', 'archives.creationTime', 'backups.remotePath', 'backups.manifestJson', 'backups.appConfigJson', '(archives.icon IS NOT NULL) AS hasIcon', '(archives.appStoreIcon IS NOT NULL) AS hasAppStoreIcon' ];
function postProcess(result) {
assert.strictEqual(typeof result, 'object');
@@ -25,6 +25,9 @@ function postProcess(result) {
result.appConfig = result.appConfigJson ? safe.JSON.parse(result.appConfigJson) : null;
delete result.appConfigJson;
result.manifest = result.manifestJson ? safe.JSON.parse(result.manifestJson) : null;
delete result.manifestJson;
result.iconUrl = result.hasIcon || result.hasAppStoreIcon ? `/api/v1/archives/${result.id}/icon` : null;
return result;