mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
fix(fs): permit square brackets []
in file paths (#21625)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
This commit is contained in:
parent
d6b5679977
commit
b853af2c7d
2 changed files with 2 additions and 1 deletions
|
@ -73,6 +73,7 @@ describe('util/fs/util', () => {
|
||||||
${'/foo'} | ${false}
|
${'/foo'} | ${false}
|
||||||
${'&&'} | ${false}
|
${'&&'} | ${false}
|
||||||
${';'} | ${true}
|
${';'} | ${true}
|
||||||
|
${'./[foo]/bar'} | ${true}
|
||||||
`('isValidPath($value) == $expected', ({ value, expected }) => {
|
`('isValidPath($value) == $expected', ({ value, expected }) => {
|
||||||
expect(isValidPath(value, 'cacheDir')).toBe(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/
|
// http://www.mtu.edu/umc/services/digital/writing/characters-avoid/
|
||||||
// We allow spaces, but not newlines
|
// 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 {
|
function assertBaseDir(path: string, baseDir: string): void {
|
||||||
if (!path.startsWith(baseDir)) {
|
if (!path.startsWith(baseDir)) {
|
||||||
|
|
Loading…
Reference in a new issue