Skip to content

Commit

Permalink
support srcDir with leading slash
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav0 committed Apr 4, 2020
1 parent 85498f7 commit 5fdf081
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class Funnel extends Plugin {

let inputPath = this.inputPaths[0];
if (this.srcDir) {
this.srcDir = ensureRelative(this.srcDir);
inputPath = path.join(inputPath, this.srcDir);
}

Expand Down
17 changes: 17 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ describe('broccoli-funnel', function() {
expect(assertions).to.equal(0, 'Build did not throw an error, relative path traversal worked.');
});

it('accepts srcDir with leading slash', async function() {
let assertions = 0;

let node = new Funnel('.', {
srcDir: '/node_modules',
destDir: 'foo',
});

output = createBuilder(node);
try {
await output.build();
} catch (error) {
assertions++;
}
expect(assertions).to.equal(0, 'Build did not throw an error, relative path traversal worked.');
});

it('throws error on unspecified allowEmpty', async function() {
let assertions = 0;
let inputPath = `${FIXTURE_INPUT}/dir1`;
Expand Down

0 comments on commit 5fdf081

Please sign in to comment.