MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / getSanitizedUrlString

Function getSanitizedUrlString

packages/core/src/utils/url.ts:252–265  ·  view source on GitHub ↗
(url: PartialURL)

Source from the content-addressed store, hash-verified

250 * see: https://develop.sentry.dev/sdk/data-handling/#structuring-data
251 */
252export 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.

Callers 5

url.test.tsFile · 0.90
getBreadcrumbDataFunction · 0.90
getRequestSpanDataFunction · 0.90
getSanitizedUrlFunction · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected