Skip to content

Commit

Permalink
saving original path to generate repository URL
Browse files Browse the repository at this point in the history
Signed-off-by: jorgee <[email protected]>
  • Loading branch information
jorgee committed Dec 9, 2024
1 parent f8eb89e commit df795ff
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,21 @@ final class AzureRepositoryProvider extends RepositoryProvider {

private String user
private String repo
private boolean includesRepo; //Flag to indicate if project already include the repo
private String urlPath;
private String continuationToken

AzureRepositoryProvider(String project, ProviderConfig config=null) {
/*
Azure repo format follows Organization/Project/Repository where Project can be optional
If Project is not present then Repository is used as Project (and also as Repository)
*/
this.urlPath = project
def tokens = project.tokenize('/')
this.repo = tokens.removeLast()
if( tokens.size() == 1){
this.project = [tokens.first(), this.repo].join('/')
this.includesRepo = true
}else{
this.project = tokens.join('/')
this.includesRepo = false
}
this.config = config ?: new ProviderConfig('azurerepos')
this.continuationToken = null
Expand Down Expand Up @@ -167,7 +166,7 @@ final class AzureRepositoryProvider extends RepositoryProvider {
/** {@inheritDoc} */
@Override
String getRepositoryUrl() {
includesRepo ? "${config.server}/$project" : "${config.server}/$project/$repo"
"${config.server}/${urlPath}"
}

/** {@inheritDoc} */
Expand Down

0 comments on commit df795ff

Please sign in to comment.