fix(artifactory): preserve base URL path component when building request URLs - #94
Conversation
… URL path
`new URL('/api/...', 'https://host/artifactory/')` resolves relative to the
origin, silently stripping the `/artifactory` segment. Changing `const API`
from `'/api'` to `'api'` makes the path relative to the base URL so the full
configured path is preserved.
Closes #90
Co-authored-by: Sunny Kolattukudy <kolatts@users.noreply.github.com>
|
Claude finished @claude[bot]'s task in 1m 14s —— View job PR Review Complete
Verdict: Approve — no substantive issues found. GitHub prevents the bot from approving its own PR, so posting the review here instead. What the fix does
Regression test (
|
…ace and similar hosts (#284) Strip the leading '/' from path before new URL(path, base) so that an absolute-path reference does not resolve against the origin and silently discard path components already present in base (e.g. /e/<environment-id> for Dynatrace Managed clusters). Fixes #283 — recurrence of BUG-4 root cause (same WHATWG URL spec behavior that dropped /artifactory from Artifactory base URLs in PR #94). Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Sunny Kolattukudy <kolatts@users.noreply.github.com>
Summary
const API = '/api'toconst API = 'api'insrc/services/artifactory/client.tsnew URL('/api/...', base)resolves relative to the origin, not the base path — so a configuredbaseUrlofhttps://host/artifactoryhad its/artifactorysegment silently dropped on every request'api/...'),new URLresolves against the full base URL path, producing the correcthttps://host/artifactory/api/...src/lib/http.test.tsthat stubsfetchto verify the URL includes the base path componentCloses #90
Generated with Claude Code