Skip to content

Commit

Permalink
test: reproduce failing upper path test
Browse files Browse the repository at this point in the history
In an attempt to reproduce the test case presented in #167
  • Loading branch information
matt-forster committed Dec 17, 2020
1 parent 78de22f commit 1cc69a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/fs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ describe('FileSystem', function () {
nodePath.resolve('/tmp/ftp-srv'));
});

it('cannot escape root - win, escaped', function () {
// eslint-disable-next-line no-useless-escape
const result = fs._resolvePath('\/../../../');
expect(result).to.be.an('object');
expect(result.clientPath).to.equal(
nodePath.normalize('/'));
expect(result.fsPath).to.equal(
nodePath.resolve('/tmp/ftp-srv'));
});

it('cannot escape root - backslash prefix', function () {
const result = fs._resolvePath('\\/../../../../../../');
expect(result).to.be.an('object');
Expand Down

0 comments on commit 1cc69a6

Please sign in to comment.