coder / envbuilder

Build development environments from a Dockerfile on Docker, Kubernetes, and OpenShift. Enable developers to modify their development environment quickly.
Apache License 2.0
123 stars 24 forks source link

bug: handle git URLs that are not valid URLs #175

Closed johnstcn closed 3 months ago

johnstcn commented 3 months ago

We cannot assume that anything folks pass to GIT_URL will be a valid URL.

Example:

error: parse "git@github.com:johnstcn/test-private-devcontainer.git": first path segment in URL cannot contain colon
Forestsoft-de commented 3 months ago

the issue comes from CloneRepo method. url.Parse is not a good solution for git url. Would this package a solution? https://pkg.go.dev/github.com/whilp/git-urls#section-documentation

I am on a fix right now because i need the ssh clone.

BrunoQuaresma commented 3 months ago

More context after talking to @johnstcn about this issue:

There are two places we parse git URLs right now apart from test code:

We could also use the library suggested, but my preference is to avoid extra imports if possible.