mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-14 08:28:07 +08:00
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:
@@ -97,6 +97,24 @@ describe('globber', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('does not match file with trailing slash when implicitDescendants=true', async () => {
|
||||
// Create the following layout:
|
||||
// <root>
|
||||
// <root>/file
|
||||
const root = path.join(
|
||||
getTestTemp(),
|
||||
'defaults-to-implicit-descendants-true'
|
||||
)
|
||||
|
||||
const filePath = path.join(root, 'file')
|
||||
|
||||
await fs.mkdir(root, {recursive: true})
|
||||
await fs.writeFile(filePath, 'test file content')
|
||||
|
||||
const itemPaths = await glob(`${filePath}/`, {})
|
||||
expect(itemPaths).toEqual([])
|
||||
})
|
||||
|
||||
it('defaults to omitBrokenSymbolicLinks=true', async () => {
|
||||
// Create the following layout:
|
||||
// <root>
|
||||
|
||||
Reference in New Issue
Block a user