From d4eacda649e534387ecc496f288aaae8d2d3da0c Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Tue, 19 Feb 2019 12:14:05 -0800 Subject: [PATCH] Disable import/export outside of test mode; not currently used --- js/modules/backup.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/modules/backup.js b/js/modules/backup.js index f527a142e..3a9a4e80e 100644 --- a/js/modules/backup.js +++ b/js/modules/backup.js @@ -1211,6 +1211,11 @@ function deleteAll(pattern) { const ARCHIVE_NAME = 'messages.tar.gz'; async function exportToDirectory(directory, options) { + const env = window.getEnvironment(); + if (env !== 'test') { + throw new Error('export is only supported in test mode'); + } + options = options || {}; if (!options.key) { @@ -1278,6 +1283,11 @@ async function importFromDirectory(directory, options) { const archivePath = path.join(directory, ARCHIVE_NAME); if (fs.existsSync(archivePath)) { + const env = window.getEnvironment(); + if (env !== 'test') { + throw new Error('import is only supported in test mode'); + } + // we're in the world of an encrypted, zipped backup if (!options.key) { throw new Error(