(url: PartialURL)
| 250 | * see: https://develop.sentry.dev/sdk/data-handling/#structuring-data |
| 251 | */ |
| 252 | export function getSanitizedUrlString(url: PartialURL): string { |
| 253 | const { protocol, host, path } = url; |
| 254 | |
| 255 | const filteredHost = |
| 256 | host |
| 257 | // Always filter out authority |
| 258 | ?.replace(/^.*@/, '[filtered]:[filtered]@') |
| 259 | // Don't show standard :80 (http) and :443 (https) ports to reduce the noise |
| 260 | // TODO: Use new URL global if it exists |
| 261 | .replace(/(:80)$/, '') |
| 262 | .replace(/(:443)$/, '') || ''; |
| 263 | |
| 264 | return `${protocol ? `${protocol}://` : ''}${filteredHost}${path}`; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Strips the content from a data URL, returning a placeholder with the MIME type. |
no test coverage detected