Do not encrypt empty path

This commit is contained in:
Girish Ramakrishnan
2018-07-31 19:41:03 -07:00
parent 498642b670
commit ef5dc7311f
2 changed files with 3 additions and 2 deletions

View File

@@ -325,7 +325,8 @@ function sync(backupConfig, backupId, dataDir, callback) {
syncer.sync(dataDir, function processTask(task, iteratorCallback) {
debug('sync: processing task: %j', task);
const destPath = backupConfig.key ? encryptFilePath(task.path, backupConfig.key) : task.path;
// the empty task.path is special to signify the directory
const destPath = task.path && backupConfig.key ? encryptFilePath(task.path, backupConfig.key) : task.path;
const backupFilePath = path.join(getBackupFilePath(backupConfig, backupId, backupConfig.format), destPath);
if (task.operation === 'removedir') {