Skip to content

Commit

Permalink
fix hook get by path (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanoy authored Aug 3, 2020
1 parent 1bc1752 commit 511b717
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/com/redhat/labs/omp/model/GitlabProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@
@NoArgsConstructor
@AllArgsConstructor
public class GitlabProject {
private static final String REGEX = "(.*) \\/ (.*) \\/ (.*) \\/ iac";
private static final String NAME_REGEX = "(.*) \\/ (.*) \\/ (.*) \\/ iac";
private static final String PATH_REGEX = "(.*)\\/(.*)\\/(.*)\\/iac";

private String pathWithNamespace;
private String nameWithNamespace;

public String getCustomerNameFromName() {
return nameWithNamespace.replaceAll(REGEX, "$2");
if(nameWithNamespace == null) {
return pathWithNamespace.replaceAll(PATH_REGEX, "$2");
}
return nameWithNamespace.replaceAll(NAME_REGEX, "$2");
}

public String getEngagementNameFromName() {
return nameWithNamespace.replaceAll(REGEX, "$3");
if(nameWithNamespace == null) {
return pathWithNamespace.replaceAll(PATH_REGEX, "$3");
}
return nameWithNamespace.replaceAll(NAME_REGEX, "$3");
}
}

0 comments on commit 511b717

Please sign in to comment.