* Normalizes the host config value: trims whitespace, strips any protocol prefix, * trailing slashes, and a pasted `/api` or `/api/0` suffix (the connector appends * `/api/0` itself), and falls back to sentry.io when empty. Genuine path prefixes * (e.g. `company.com/sentry` for subpath self-hoste
(rawHost: unknown)
| 130 | * (e.g. `company.com/sentry` for subpath self-hosted installs) are preserved. |
| 131 | */ |
| 132 | function normalizeHost(rawHost: unknown): string { |
| 133 | const host = typeof rawHost === 'string' ? rawHost.trim() : '' |
| 134 | if (!host) return DEFAULT_HOST |
| 135 | return host |
| 136 | .replace(/^https?:\/\//i, '') |
| 137 | .replace(/\/+$/, '') |
| 138 | .replace(/\/api(\/0)?$/i, '') |
| 139 | .replace(/\/+$/, '') |
| 140 | .trim() |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Reads and normalizes the connector source configuration once per call. |
no test coverage detected