Skip to content

fix(go-parser): join group prefixes and route paths the way Gin does - #18

Merged
Kidkender merged 1 commit into
mainfrom
fix/go-route-path-join
Nov 13, 2026
Merged

Kidkender merged 1 commit into
mainfrom
fix/go-route-path-join

Conversation

@Kidkender

Copy link
Copy Markdown
Owner

Route paths were the plain concatenation of every Group() prefix and the route path. Groups written without slashes — Group("api").Group("v1").POST("device") — came out as apiv1device instead of /api/v1/device, and "/api/" + "/users" as /api//users. Merge after #12 for a green CI build.

Fix

joinPaths in route-parser.ts joins the way Gin does (path.Join): always rooted, no doubled slashes, keeping a trailing slash the relative path has. A route on the engine with an empty path is /.

Side effect: the auth skip-list matches method + path exactly, so routes that had a malformed path could not match it before; they now can.

Verified

App Routes Malformed paths before → after
thingspanel-backend-community 267 233 → 0
ginfast 122 2 → 0

Route paths were the plain concatenation of every Group() prefix and the
route path, so groups written without slashes (Group("api").Group("v1")
.POST("device")) came out as "apiv1device" instead of /api/v1/device, and
"/api/" + "/users" as "/api//users". Gin joins them with path.Join, keeping a
trailing slash on the relative path; joinPaths does the same.

thingspanel-backend-community: 233 of 267 routes had a malformed path, now 0.
ginfast: 2 of 122, now 0. Route counts unchanged.
@Kidkender Kidkender mentioned this pull request Nov 13, 2026
@Kidkender
Kidkender merged commit c68f0c9 into main Nov 13, 2026
1 check failed
@Kidkender
Kidkender deleted the fix/go-route-path-join branch November 13, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant