-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using git providers hosted without https fails to clone repositories #690
Comments
Hi @Tpuljak Lemme know if this works! If it is, then I'll raise a PR, so that you could be able to merge it into main. // checkHTTPSAvailable checks if the given URL is accessible via HTTPS
func checkHTTPSAvailable(source, owner, repo string) bool {
url := fmt.Sprintf("https://%s/%s/%s.git", source, owner, repo)
resp, err := http.Head(url)
if err != nil || resp.StatusCode != http.StatusOK {
return false
}
return true
}
// getCloneUrl constructs the clone URL using the appropriate protocol
func getCloneUrl(source, owner, repo string) string {
if checkHTTPSAvailable(source, owner, repo) {
return fmt.Sprintf("https://%s/%s/%s.git", source, owner, repo)
}
return fmt.Sprintf("https://%s/%s/%s.git", source, owner, repo)
} |
@RS-labhub seems great! If you tested the changes, you can raise a PR and we'll review asap. |
Done! |
Hii @Tpuljak , when I'm passing the parameters ( PS: Getting no clue May I change it to expected???
|
By the way, I fixed my old functions, where that gitlab_test.go file was throwing an error... Unit tests are passed. |
@RS-labhub I don't see a PR I can review. |
Which one PR I raise?? The one with parameters ( |
@RS-labhub as I said. Issue comments are not the place to paste and discuss code. Open a PR that passes all test with your proposed solution and we'll comment there. |
Describe the bug
When a git provider API is not available through https, Daytona fails to clone the repo because it defaults to
https
To Reproduce
Steps to reproduce the behavior:
http
https
Expected behavior
The repo can be cloned successfully via
http
Desktop (please complete the following information):
Additional context
The issue is directly related to this function https://github.com/daytonaio/daytona/blob/main/pkg/gitprovider/git_provider.go#L131
The text was updated successfully, but these errors were encountered: