You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ curl -i 'http://127.0.0.1:3000/v1/forgejo/git.madhouse-project.org/algernon/riemann-c-client/b/test%2fbranch.tar.gz'
HTTP/1.1 303 See Other
location: https://git.madhouse-project.org/algernon/riemann-c-client/archive/test/branch.tar.gz
content-length: 0
date: Mon, 30 Oct 2023 19:24:42 GMT
Just need to url encode! :)
But we can do better: just replace /:branch in the routes with /*branch, so it captures the rest of the path. Since branch is always at the end, I believe this can be done safely. It will only captures paths, not query strings. Since the /b/ or /branch/ part of the URI will route the request there, we won't have problems accidentally routing the request elsewhere, either.
When dealing with branches, don't capture just one slice of the path as
the branch name, but every part of the path from that point on. This
lets us easily deal with branches that have slashes in their names.
Since the branch is always the last part of the URI, and the `/b/` or
`/branch/` part routes things here anyway, capturing the rest of the
path is safe. Only the path is captured, query strings are not, those
aren't part of the routing.
Fixes#19.
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
Discovered in #18, honestly not something I'm personally super interested in trying to solve, but here's an issue so we don't forget.
The text was updated successfully, but these errors were encountered: