diff --git a/index.js b/index.js index d0d8a90..55ff2f3 100644 --- a/index.js +++ b/index.js @@ -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); } diff --git a/tests/index.js b/tests/index.js index 2313b8d..b31efd0 100644 --- a/tests/index.js +++ b/tests/index.js @@ -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: '/', + 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`;