Skip to content

Commit 2ada565

Browse files
authored
Quick check to circumvent regex in many cases (microsoft#164815)
* Quick check to circumvent regex in many cases * Fix logic
1 parent b7bbdc4 commit 2ada565

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/vs/platform/telemetry/common/telemetryUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ export function getPiiPathsFromEnvironment(paths: IPathEnvironment): string[] {
287287
*/
288288
function anonymizeFilePaths(stack: string, cleanupPatterns: RegExp[]): string {
289289

290+
// Fast check to see if it is a file path to avoid doing unnecessary heavy regex work
291+
if (!stack || (!stack.includes('/') && !stack.includes('\\'))) {
292+
return stack;
293+
}
294+
290295
let updatedStack = stack;
291296

292297
const cleanUpIndexes: [number, number][] = [];

0 commit comments

Comments
 (0)