diff --git a/src/backupformat/tgz.js b/src/backupformat/tgz.js index 62ce51714..2343493b7 100644 --- a/src/backupformat/tgz.js +++ b/src/backupformat/tgz.js @@ -175,7 +175,7 @@ async function tarPack(dataLayout, encryption, uploader, progressCallback) { await uploader.finish(); return { stats: { fileCount, ...ps.stats() }, - integrity: { size: ps.stats().transferred, sha256: hash.digest('hex') } + integrity: { size: ps.stats().transferred, fileCount, sha256: hash.digest('hex') } }; } diff --git a/src/backups.js b/src/backups.js index 5f83b2f23..f8a41cf0e 100644 --- a/src/backups.js +++ b/src/backups.js @@ -71,8 +71,8 @@ async function add(data) { const prefixId = data.type === exports.BACKUP_TYPE_APP ? `${data.type}_${data.identifier}` : data.type; // type and identifier are same for other types const id = `${prefixId}_v${data.packageVersion}_${hat(32)}`; // id is used by the UI to derive dependent packages. making this a UUID will require a lot of db querying const appConfigJson = data.appConfig ? JSON.stringify(data.appConfig) : null; - const statsJson = data.statsJson ? JSON.stringify(data.statsJson) : null; - const integrityJson = data.integrityJson ? JSON.stringify(data.integrityJson) : null; + const statsJson = data.stats ? JSON.stringify(data.stats) : null; + const integrityJson = data.integrity ? JSON.stringify(data.integrity) : null; const [error] = await safe(database.query('INSERT INTO backups (id, remotePath, identifier, encryptionVersion, packageVersion, type, creationTime, state, dependsOnJson, manifestJson, preserveSecs, appConfigJson, targetId, statsJson, integrityJson) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [ id, data.remotePath, data.identifier, data.encryptionVersion, data.packageVersion, data.type, creationTime, data.state, JSON.stringify(data.dependsOn), manifestJson, data.preserveSecs, appConfigJson, data.targetId, statsJson, integrityJson ])); diff --git a/src/progress-stream.js b/src/progress-stream.js index b14d62cdd..7a1f3efd6 100644 --- a/src/progress-stream.js +++ b/src/progress-stream.js @@ -22,8 +22,8 @@ class ProgressStream extends TransformStream { } stats() { - const totalSecs = Math.round((Date.now() - this.#startTime)/1000); - return { startTime: this.#startTime, totalSecs, transferred: this.#transferred }; + const totalMsecs = (Date.now() - this.#startTime)/1000; + return { startTime: this.#startTime, totalMsecs, transferred: this.#transferred }; } _start() {