diff --git a/src/storage/caas.js b/src/storage/caas.js index 9bd1de4dc..89d15a63f 100644 --- a/src/storage/caas.js +++ b/src/storage/caas.js @@ -95,7 +95,7 @@ function backup(apiConfig, backupId, sourceDir, callback) { callback(null); }); - targz.create([{ source: sourceDir, destination: '.' }], apiConfig.key || null, passThrough, callback); + targz.create(sourceDir, apiConfig.key || null, passThrough, callback); }); } diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index 60f589052..683385ec2 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -69,7 +69,7 @@ function backup(apiConfig, backupId, sourceDir, callback) { callback(null); }); - targz.create([{ source: sourceDir, destination: '.' }], apiConfig.key || null, fileStream, callback); + targz.create(sourceDir, apiConfig.key || null, fileStream, callback); }); } diff --git a/src/storage/s3.js b/src/storage/s3.js index a100278b5..52a3184d7 100644 --- a/src/storage/s3.js +++ b/src/storage/s3.js @@ -100,7 +100,7 @@ function backup(apiConfig, backupId, sourceDir, callback) { callback(null); }); - targz.create([{ source: sourceDir, destination: '.' }], apiConfig.key || null, passThrough, callback); + targz.create(sourceDir, apiConfig.key || null, passThrough, callback); }); } diff --git a/src/storage/targz.js b/src/storage/targz.js index a04af056c..8a03c2eef 100644 --- a/src/storage/targz.js +++ b/src/storage/targz.js @@ -14,18 +14,16 @@ var assert = require('assert'), tar = require('tar-fs'), zlib = require('zlib'); -function create(sourceDirectories, key, outStream, callback) { - assert(Array.isArray(sourceDirectories)); +function create(sourceDir, key, outStream, callback) { + assert.strictEqual(typeof sourceDir, 'string'); assert(key === null || typeof key === 'string'); assert.strictEqual(typeof callback, 'function'); var pack = tar.pack('/', { dereference: false, // pack the symlink and not what it points to - entries: sourceDirectories.map(function (m) { return m.source; }), + entries: [ sourceDir ], map: function(header) { - sourceDirectories.forEach(function (m) { - header.name = header.name.replace(new RegExp('^' + m.source + '(/?)'), m.destination + '$1'); - }); + header.name = header.name.replace(new RegExp('^' + sourceDir + '(/?)'), '.$1'); // make paths relative return header; }, strict: false // do not error for unknown types (skip fifo, char/block devices)