andygrunwald / go-gerrit

Go client/library for Gerrit Code Review
https://godoc.org/github.com/andygrunwald/go-gerrit
MIT License
95 stars 40 forks source link

Can't get the library working for repo names containing slashes #117

Closed dpotapov closed 2 years ago

dpotapov commented 2 years ago

E.g. this call fails with 404 error:

branches, _, err := gr.Projects.ListBranches("my/project/name", &gerrit.BranchOptions{})

it seems it keeps generating unescaped URLs like http://mygerritserver/r/a/projects/my/project/name/branches/ which are not valid for Gerrit.

When debugging the code, I found that the function buildURLForRequest(urlStr string) (string, error) unescapes the project part.

dpotapov commented 2 years ago

I've figured it out. My gerrit server redirects all http requests with extra /r prefix in the URL and while doing that it unescapes the properly escaped path.