Skip to content

Commit

Permalink
Disable import/export outside of test mode; not currently used
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Feb 21, 2019
1 parent 77ae717 commit d4eacda
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/modules/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit d4eacda

Please sign in to comment.