Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit d0dccee

Browse files
authored
Merge pull request #58 from benj58xu/master
Enhance GitHubParsed so that it can handle URLs with ports and additional path segment
2 parents 371ee05 + 091557e commit d0dccee

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</description>
1111
<url>https://github.com/Hygieia/${repository.name}</url>
1212
<packaging>jar</packaging>
13-
<version>3.2.4-SNAPSHOT</version>
13+
<version>3.2.5-SNAPSHOT</version>
1414

1515
<parent>
1616
<groupId>org.springframework.boot</groupId>

src/main/java/com/capitalone/dashboard/model/GitHubParsed.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ private void parse() throws MalformedURLException, HygieiaException {
5252
baseApiUrl = protocol + "://" + PUBLIC_GITHUB_BASE_API;
5353
apiUrl = protocol + "://" + PUBLIC_GITHUB_REPO_HOST + path;
5454
graphQLUrl = protocol + "://" + PUBLIC_GITHUB_GRAPHQL;
55+
} else if (parts.length>3) {
56+
orgName = parts[parts.length-2];
57+
repoName = parts[parts.length-1];
58+
String baseUrl = protocol + "://" + host;
59+
if (u.getPort()>0) baseUrl += ":" + u.getPort();
60+
for (int i=1; i<parts.length-2; i++) {
61+
baseUrl += "/" + parts[i];
62+
}
63+
apiUrl = baseUrl + SEGMENT_API + "/" + orgName + "/" + repoName;
64+
baseApiUrl = baseUrl + BASE_API;
65+
graphQLUrl = baseUrl + SEGMENT_GRAPHQL;
5566
} else {
5667
apiUrl = protocol + "://" + host + SEGMENT_API + path;
5768
baseApiUrl = protocol + "://" + host + BASE_API;

0 commit comments

Comments
 (0)