storage: make listDir return paths relative to the root
this seems more natural to work with
This commit is contained in:
@@ -122,7 +122,7 @@ describe('Storage', function () {
|
||||
marker = result.marker;
|
||||
}
|
||||
|
||||
const expectedFiles = execSync(`find . -type f -printf '%P\n'`, { cwd: sourceDir, encoding: 'utf8' }).trim().split('\n');
|
||||
const expectedFiles = execSync(`find . -type f -printf '%P\n'`, { cwd: sourceDir, encoding: 'utf8' }).trim().split('\n').map(p => `storage/${p}`);
|
||||
expect(allFiles.map(function (f) { return f.path; }).sort()).to.eql(expectedFiles.sort());
|
||||
});
|
||||
|
||||
@@ -189,7 +189,7 @@ describe('Storage', function () {
|
||||
const backupConfig = {
|
||||
provider: 's3',
|
||||
key: 'key',
|
||||
prefix: 'unit.test',
|
||||
prefix: 'prefix-test',
|
||||
bucket: 'cloudron-storage-test',
|
||||
accessKeyId: 'testkeyid',
|
||||
secretAccessKey: 'testsecret',
|
||||
@@ -239,7 +239,7 @@ describe('Storage', function () {
|
||||
async copyObject(params) {
|
||||
// CopySource already has the bucket path!
|
||||
// Key already has prefix but no bucket ptah!
|
||||
// console.log('Copying:', path.join(basePath, params.CopySource), path.join(bucketPathNoPrefix, params.Key));
|
||||
console.log('Copying:', path.join(basePath, params.CopySource), path.join(bucketPathNoPrefix, params.Key));
|
||||
await fs.promises.mkdir(path.dirname(path.join(bucketPathNoPrefix, params.Key)), { recursive: true });
|
||||
await fs.promises.copyFile(path.join(basePath, params.CopySource.replace(/%2B/g, '+')), path.join(bucketPathNoPrefix, params.Key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user