ban backslashes

This commit is contained in:
Robert Brignull
2020-07-09 18:27:46 +01:00
parent 24367a89b5
commit 60126bfb39
3 changed files with 19 additions and 1 deletions

7
lib/config-utils.js generated
View File

@@ -136,6 +136,13 @@ function validateAndSanitisePath(originalPath, propertyName, configFile) {
core.warning(getConfigFilePropertyError(configFile, propertyName, '"' + originalPath + '" contains an unsupported character. ' +
'The filter pattern characters ?, +, [, ], ! are not supported and will be matched literally.'));
}
// Ban any uses of backslash for now.
// This may not play nicely with project layouts.
// This restriction can be lifted later if we determine they are ok.
if (path.indexOf('\\') !== -1) {
throw new Error(getConfigFilePropertyError(configFile, propertyName, '"' + originalPath + '" contains an "\\" character. These are not allowed in filters. ' +
'If running on windows we recommend using "/" instead for path filters.'));
}
return path;
}
exports.validateAndSanitisePath = validateAndSanitisePath;