mirror of https://github.com/portainer/portainer
Fix syntax errors
parent
39ae441b15
commit
cf699d8ec3
|
@ -253,18 +253,19 @@ func parseHttpUrl(rawUrl string) (*azureOptions, error) {
|
|||
return nil, errors.Wrap(err, "failed to parse HTTP url")
|
||||
}
|
||||
azureDevOpsServerURL, azureDevOpsServerURLOK := os.LookupEnv("AZURE_DEVOPS_SERVER_URL")
|
||||
var azureDevOpsServerParsedURL *url.URL
|
||||
if azureDevOpsServerURLOK {
|
||||
azureDevOpsServerParsedURL, err := url.Parse(rawUrl)
|
||||
azureDevOpsServerParsedURL, err = url.Parse(azureDevOpsServerURL)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to parse Azure DevOps Server url")
|
||||
}
|
||||
}
|
||||
opt := azureOptions{}
|
||||
switch {
|
||||
case azureDevOpsServerURLOK && u.Host == azureDevOpsServerParsedURL.host:
|
||||
path = strings.Split(strings.ReplaceAll(u.Path, azureDevOpsServerParsedURL.path, ""), "/")
|
||||
case azureDevOpsServerURLOK && azureDevOpsServerParsedURL != nil && u.Host == azureDevOpsServerParsedURL.Host:
|
||||
path := strings.Split(strings.ReplaceAll(u.Path, azureDevOpsServerParsedURL.Path, ""), "/")
|
||||
if len(path) != 5 {
|
||||
expectedUrl = azureDevOpsServerURL + "/{Collection}/{Project}/_git/{Repository}"
|
||||
expectedUrl := azureDevOpsServerURL + "/{Collection}/{Project}/_git/{Repository}"
|
||||
return nil, errors.Errorf("want url %s, got %s", expectedUrl, u)
|
||||
}
|
||||
opt.organisation = path[1] //In case of AzureDevops Server Organisation is replaced with Collection but their logic is the same
|
||||
|
|
Loading…
Reference in New Issue