diff --git a/lib/main.js b/lib/main.js index 0f6e55c..96a0b00 100644 --- a/lib/main.js +++ b/lib/main.js @@ -55,7 +55,7 @@ export default class SinkMemory extends Sink { return; } - const pathname = join(this._rootPath, filePath); + const pathname = join(this._rootPath, filePath).replace(/\\/g, "/"); if (pathname.indexOf(this._rootPath) !== 0) { reject(new Error(`Directory traversal - ${filePath}`)); @@ -109,7 +109,7 @@ export default class SinkMemory extends Sink { return; } - const pathname = join(this._rootPath, filePath); + const pathname = join(this._rootPath, filePath).replace(/\\/g, "/"); if (pathname.indexOf(this._rootPath) !== 0) { this._counter.inc({ labels: { operation } }); @@ -168,7 +168,7 @@ export default class SinkMemory extends Sink { return; } - const pathname = join(this._rootPath, filePath); + const pathname = join(this._rootPath, filePath).replace(/\\/g, "/"); if (pathname.indexOf(this._rootPath) !== 0) { this._counter.inc({ labels: { operation } }); @@ -212,7 +212,7 @@ export default class SinkMemory extends Sink { return; } - const pathname = join(this._rootPath, filePath); + const pathname = join(this._rootPath, filePath).replace(/\\/g, "/"); if (pathname.indexOf(this._rootPath) !== 0) { this._counter.inc({ labels: { operation } });