Skip to content

Commit b2cd694

Browse files
authored
must use valid path to look up project (#119)
1 parent acee9e1 commit b2cd694

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/main/java/com/redhat/labs/lodestar/service/EngagementService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public Status getProjectStatus(String customerName, String engagementName) {
189189
}
190190

191191
public Optional<Project> getProject(String customerName, String engagementName) {
192-
String fullPath = GitLabPathUtils.getPath(engagementPathPrefix, customerName, engagementName);
192+
String fullPath = GitLabPathUtils.getValidPath(engagementPathPrefix, customerName, engagementName);
193193

194194
LOGGER.debug("Full path {}", fullPath);
195195
return projectService.getProjectByIdOrPath(fullPath);

src/main/java/com/redhat/labs/lodestar/service/ProjectStructureService.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,7 @@ void removeIfEmpty(int retryCount, Runnable runnable) {
295295

296296
Optional<Project> findProjectByPath(String engagementPathPrefix, String customerName, String projectName) {
297297

298-
String customerPath = GitLabPathUtils.generateValidPath(customerName);
299-
String projectPath = GitLabPathUtils.generateValidPath(projectName);
300-
String fullPath = GitLabPathUtils.getPath(engagementPathPrefix, customerPath, projectPath);
301-
298+
String fullPath = GitLabPathUtils.getValidPath(engagementPathPrefix, customerName, projectName);
302299
return projectService.getProjectByIdOrPath(fullPath);
303300

304301
}

src/main/java/com/redhat/labs/lodestar/utils/GitLabPathUtils.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,12 @@ public static String getPath(String engagementPathPrefix, String customerName, S
5050
.append("/iac").toString();
5151
}
5252

53+
public static String getValidPath(String engagementPathPrefix, String customerName, String engagementName) {
54+
55+
String customerPath = GitLabPathUtils.generateValidPath(customerName);
56+
String projectPath = GitLabPathUtils.generateValidPath(engagementName);
57+
return GitLabPathUtils.getPath(engagementPathPrefix, customerPath, projectPath);
58+
59+
}
60+
5361
}

0 commit comments

Comments
 (0)