Prevent accidental file matching when glob contains trailing slash (#805)

* Draft Solution

* Update internal-globber.ts

* Cleanup

* Fix Test

* Cleanup
This commit is contained in:
Luke Tomlinson
2021-05-14 14:12:26 -04:00
committed by GitHub
parent b33912b7cc
commit 98549fbf21
4 changed files with 43 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ describe('pattern', () => {
it('escapes homedir', async () => {
const home = path.join(getTestTemp(), 'home-with-[and]')
await fs.mkdir(home, {recursive: true})
const pattern = new Pattern('~/m*', undefined, home)
const pattern = new Pattern('~/m*', false, undefined, home)
expect(pattern.searchPath).toBe(home)
expect(pattern.match(path.join(home, 'match'))).toBeTruthy()