Skip to content

Commit 4d938da

Browse files
committed
Fix GitHub location parsing
1 parent a4bd5aa commit 4d938da

File tree

1 file changed

+3
-2
lines changed
  • core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/aspectmodel/resolver

1 file changed

+3
-2
lines changed

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/aspectmodel/resolver/GithubRepository.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public record GithubRepository(
2525
Ref branchOrTag
2626
) {
2727
public GithubRepository( final String owner, final String repository, final Ref branchOrTag ) {
28-
this( "api.github.com", owner, repository, branchOrTag );
28+
this( "github.com", owner, repository, branchOrTag );
2929
}
3030

3131
public sealed interface Ref {
@@ -51,7 +51,8 @@ public String refType() {
5151
public URL zipLocation() {
5252
// See https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#download-a-repository-archive-zip
5353
// General URL structure: https://api.github.com/repos/OWNER/REPO/zipball/REF
54-
final String url = "https://%s/repos/%s/%s/zipball/%s".formatted( host(), owner(), repository(), branchOrTag().name() );
54+
final String theHost = host().equals( "github.com" ) ? "api.github.com" : host();
55+
final String url = "https://%s/repos/%s/%s/zipball/%s".formatted( theHost, owner(), repository(), branchOrTag().name() );
5556
try {
5657
return new URL( url );
5758
} catch ( final MalformedURLException exception ) {

0 commit comments

Comments
 (0)