Skip to content
Snippets Groups Projects
Unverified Commit b853af2c authored by Rob Hannay's avatar Rob Hannay Committed by GitHub
Browse files

fix(fs): permit square brackets `[]` in file paths (#21625)

parent d6b56799
Branches
Tags
No related merge requests found
......@@ -73,6 +73,7 @@ describe('util/fs/util', () => {
${'/foo'} | ${false}
${'&&'} | ${false}
${';'} | ${true}
${'./[foo]/bar'} | ${true}
`('isValidPath($value) == $expected', ({ value, expected }) => {
expect(isValidPath(value, 'cacheDir')).toBe(expected);
});
......
......@@ -5,7 +5,7 @@ import { logger } from '../../logger';
// http://www.mtu.edu/umc/services/digital/writing/characters-avoid/
// We allow spaces, but not newlines
const restricted = /[[\]#%&<>*?\b\n\r\0!'"|‘“^`]/;
const restricted = /[#%&<>*?\b\n\r\0!'"|‘“^`]/;
function assertBaseDir(path: string, baseDir: string): void {
if (!path.startsWith(baseDir)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment