(value: string)
| 108 | } |
| 109 | |
| 110 | export function sanitizePathString(value: string): string { |
| 111 | const home = homedir(); |
| 112 | const username = userInfo().username; |
| 113 | let sanitized = value; |
| 114 | if (home) { |
| 115 | sanitized = sanitized.replace(new RegExp(escapeRegex(home), "g"), "~"); |
| 116 | } |
| 117 | sanitized = sanitized.replace(/\/Users\/[^/]+\//g, "/Users/<USER>/"); |
| 118 | sanitized = sanitized.replace(/\/home\/[^/]+\//g, "/home/<USER>/"); |
| 119 | sanitized = sanitized.replace(/C:\\Users\\[^\\]+\\/g, "C:\\Users\\<USER>\\"); |
| 120 | if (username) { |
| 121 | sanitized = sanitized.replace(new RegExp(escapeRegex(username), "g"), "<USER>"); |
| 122 | } |
| 123 | return sanitized; |
| 124 | } |
| 125 | |
| 126 | const SECRET_TEXT_PATTERNS: Array<{ |
| 127 | pattern: RegExp; |
no test coverage detected