fix: use url.JoinPath for list/diff command URLs#915
Conversation
Four commands still built URLs with fmt.Sprintf("%s/api/v2/...",
global.Host, ...), producing double-slash URLs and 404s when --host
or KOSLI_HOST had a trailing slash. Switch to url.JoinPath with
url.Values for query params, matching the pattern adopted in #695.
Affected commands: list artifacts, list approvals, list snapshots,
diff snapshots.
|
Claude finished @dangrondahl's task in 1m 56s —— View job Review of PR #915
Static AnalysisAll three checks pass cleanly:
Code ReviewThis PR looks good. The changes are correct, consistent, and well-scoped. No issues found. Correctness — All four commands now use Consistency — The Improved safety in No test changes — The existing No bugs, security issues, or performance concerns. Ship it. |
Align list/diff URL construction with the codebase convention (logEnvironment.go, listTrails.go) by using strconv.Itoa / strconv.FormatBool instead of fmt.Sprintf for int/bool query parameters. Cosmetic; no behavior change.
Summary
Fixes the double-slash URL bug in four commands that were missed by #695. When
--hostorKOSLI_HOSThas a trailing slash, the oldfmt.Sprintf("%s/api/v2/...", global.Host, ...)pattern produced//api/v2/...URLs and 404 errors.Affected commands:
kosli list artifactskosli list approvalskosli list snapshotskosli diff snapshotsAll four now use
url.JoinPath+url.Values, matching the pattern adopted across the rest of the codebase.Closes #913
Test plan
make buildsucceedsmake lintpasseskosli list artifacts --host https://app.kosli.com/ ...no longer returns 404