From ee9d068c670315ff56a34eb0c641fcaece845358 Mon Sep 17 00:00:00 2001 From: Matyrobbrt <65940752+Matyrobbrt@users.noreply.github.com> Date: Tue, 30 Apr 2024 23:52:45 +0300 Subject: [PATCH] Fix installer URLs without a trailing slash (#159) * Fix installer URLs without a leading slash `URI#resolve` is stupid. * I meant trailing trust me --- .../gradle/dsl/platform/util/RepositoryCollection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dsl/platform/src/main/groovy/net/neoforged/gradle/dsl/platform/util/RepositoryCollection.java b/dsl/platform/src/main/groovy/net/neoforged/gradle/dsl/platform/util/RepositoryCollection.java index 6cf5af213..9da622bf2 100644 --- a/dsl/platform/src/main/groovy/net/neoforged/gradle/dsl/platform/util/RepositoryCollection.java +++ b/dsl/platform/src/main/groovy/net/neoforged/gradle/dsl/platform/util/RepositoryCollection.java @@ -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 getURLs() { return urls; } + + private static URI addTrailingSlash(URI uri) { + String asString = uri.toString(); + if (asString.endsWith("/")) return uri; + return URI.create(asString + "/"); + } }