Skip to content

Commit

Permalink
Fix installer URLs without a trailing slash (#159)
Browse files Browse the repository at this point in the history
* Fix installer URLs without a leading slash

`URI#resolve` is stupid.

* I meant trailing trust me
  • Loading branch information
Matyrobbrt authored Apr 30, 2024
1 parent b483eb1 commit ee9d068
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ public class RepositoryCollection {

public RepositoryCollection(ProviderFactory providers, ObjectFactory objects, RepositoryHandler handler) {
this.urls = objects.listProperty(URI.class);
handler.withType(MavenArtifactRepository.class).configureEach(repo -> urls.add(providers.provider(repo::getUrl)));
handler.withType(MavenArtifactRepository.class).configureEach(repo -> urls.add(providers.provider(repo::getUrl).map(RepositoryCollection::addTrailingSlash)));
}

public ListProperty<URI> getURLs() {
return urls;
}

private static URI addTrailingSlash(URI uri) {
String asString = uri.toString();
if (asString.endsWith("/")) return uri;
return URI.create(asString + "/");
}
}

0 comments on commit ee9d068

Please sign in to comment.