Backup E2E test: Normalize paths because glob returns / on WIN
This commit is contained in:
parent
bd17c298a2
commit
6ec6bf08c8
1 changed files with 5 additions and 3 deletions
|
@ -266,11 +266,13 @@ describe('Backup', () => {
|
||||||
return _.omit(model, ['id']);
|
return _.omit(model, ['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
const slash = path.sep === '/' ? '\\/' : '\\\\';
|
// On windows, attachmentsPath has a normal windows path format (\ separators), but
|
||||||
const twoSlashes = new RegExp(`.*${slash}.*${slash}.*`);
|
// glob returns only /. We normalize to / separators for our manipulations.
|
||||||
|
const twoSlashes = /[^/]*\/[^/]*\/[^/]*/;
|
||||||
|
const normalizedBase = attachmentsPath.replace(/\\/g, '/');
|
||||||
function removeDirs(dirs) {
|
function removeDirs(dirs) {
|
||||||
return _.filter(dirs, (fullDir) => {
|
return _.filter(dirs, (fullDir) => {
|
||||||
const dir = fullDir.replace(attachmentsPath, '');
|
const dir = fullDir.replace(normalizedBase, '');
|
||||||
return twoSlashes.test(dir);
|
return twoSlashes.test(dir);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue