Quick check to circumvent regex in many cases (#164815)

* Quick check to circumvent regex in many cases

* Fix logic
This commit is contained in:
Logan Ramos 2022-10-27 11:41:59 -04:00 committed by GitHub
parent b7bbdc424f
commit 2ada565d06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -287,6 +287,11 @@ export function getPiiPathsFromEnvironment(paths: IPathEnvironment): string[] {
*/
function anonymizeFilePaths(stack: string, cleanupPatterns: RegExp[]): string {
// Fast check to see if it is a file path to avoid doing unnecessary heavy regex work
if (!stack || (!stack.includes('/') && !stack.includes('\\'))) {
return stack;
}
let updatedStack = stack;
const cleanUpIndexes: [number, number][] = [];