Skip to content
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

feat(gitlab): support relative URL for gilab server #1454

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions server/events/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ func NewRepo(vcsHostType VCSHostType, repoFullName string, cloneURL string, vcsU
// and because the caller in that case actually constructs the clone url
// from the repo name and so there's no point checking if they match.
// Azure DevOps also does not require .git at the end of clone urls.
if vcsHostType != BitbucketServer && vcsHostType != AzureDevops {
expClonePath := fmt.Sprintf("/%s.git", repoFullName)
expClonePath := fmt.Sprintf("/%s.git", repoFullName)
if vcsHostType != BitbucketServer && vcsHostType != AzureDevops && vcsHostType != Gitlab {
if expClonePath != cloneURLParsed.Path {
return Repo{}, fmt.Errorf("expected clone url to have path %q but had %q", expClonePath, cloneURLParsed.Path)
}
} else if vcsHostType == Gitlab {
if !strings.Contains(cloneURL, expClonePath) {
return Repo{}, fmt.Errorf("expected clone url to have path %q but had %q", expClonePath, cloneURLParsed.Path)
}
}

// We url encode because we're using them in a URL and weird characters can
Expand Down