Skip to content

Commit

Permalink
fix: generate URL pathnames on Windows hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Aug 15, 2024
1 parent f2b74f1 commit 56e9578
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`));
Expand Down Expand Up @@ -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 } });
Expand Down Expand Up @@ -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 } });
Expand Down Expand Up @@ -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 } });
Expand Down

0 comments on commit 56e9578

Please sign in to comment.