ux(api): endpoint without a leading slash becomes /api/v1repos/... and surfaces a bare server 404 - normalize like gh instead of puzzling the user #198
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#198
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Repro
Root cause
internal/gitea/client_http.go:66joins with plain concatenation:c.baseURL + "/api/v1" + endpoint. A slashless endpoint produceshttps://<forge>/api/v1repos/..., the forge routes it nowhere, and the user gets a bare server 404 that is indistinguishable from "repo does not exist", "wrong forge", or "bad token". Hit live while diagnosing #197: three consecutive endpoints (repo GET, org repos list, user repos list) all 404ed identically and the missing slash was only found by reading the client source. The help text does say "The endpoint should start with /", but a doc line is not a guardrail - the command happily sends the malformed URL.Expected
Normalize, do not lecture: prepend the missing "/" before the join. That is gh parity (ADR 0016 - gh's own canonical examples are slashless:
gh api repos/{owner}/{repo}/releases), it can never break an existing correct call, and the puzzle class disappears entirely. Applies to both the CLImadtea apiandmadt_api_call(same client join). The --raw path should get the same treatment.If normalization is rejected for some reason, the fallback is a client-side refusal BEFORE any HTTP call:
endpoint must start with "/" - got "repos/..."; did you mean "/repos/..."?- but normalize is strictly better.Related