RFR: Accept trailing slash in URIs for git fork.

Erik Helin ehelin at openjdk.java.net
Tue Apr 14 09:33:30 UTC 2020

On Thu, 9 Apr 2020 09:45:14 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> Consider a command like this:
> $ git fork https://github.com/openjdk/skara/
> This fails with a fairly cryptic error:
> Apr 09, 2020 11:39:44 AM org.openjdk.skara.network.RestRequest transformBadResponse
> WARNING: org.openjdk.skara.network.RestRequest$QueryBuilder at 2a17b7b6
> Apr 09, 2020 11:39:44 AM org.openjdk.skara.network.RestRequest transformBadResponse
> WARNING: {"message":"Not Found","documentation_url":"https://developer.github.com/v3"}
> Exception in thread "main" java.lang.RuntimeException: Request returned bad status: 404
>         at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest.transformBadResponse(RestRequest.java:285)
>         at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest.execute(RestRequest.java:325)
>         at org.openjdk.skara.network/org.openjdk.skara.network.RestRequest$QueryBuilder.execute(RestRequest.java:156)
>         at org.openjdk.skara.forge/org.openjdk.skara.forge.github.GitHubRepository.fork(GitHubRepository.java:231)
>         at org.openjdk.skara.cli/org.openjdk.skara.cli.GitFork.main(GitFork.java:278)
>         at org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.main(GitSkara.java:186)
> The cause is the trailing '/', which is normally accepted when accessing the repository through a web browser, or when
> cloning the repository. This patch changes the git fork to also accept trailing slashes, by removing them before the
> GitHubRepository repository instance is created. It is not quite clear if this should be solved at some other level,
> but felt like a better approach to keep the APIs clean (i.e. just plain repository names), and do normalization in the
> UI tools.

Looks good!


Marked as reviewed by ehelin (Reviewer).

PR: https://git.openjdk.java.net/skara/pull/575

More information about the skara-dev mailing list