Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public MavenMetadata downloadMetadata(GroupArtifactVersion gav, @Nullable Resolv
break;
}
String href = responseBody.substring(start, end).trim();
if (href.endsWith("/")) {
if (!href.startsWith("../") && href.endsWith("/")) {
//Only look for hrefs that have directories (the directory names are the versions)
versions.add(hrefToVersion(href, uri));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.intellij.lang.annotations.Language;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
Expand Down Expand Up @@ -616,6 +615,18 @@ void deriveMetaDataFromFileRepository(@TempDir Path repoPath) throws Exception {
assertThat(metaData.getVersioning().getVersions()).hasSize(3).containsAll(List.of("1.0.0", "1.1.0", "2.0.0"));
}

@Test
void deriveMetaDataFromHtmlBasedRepository() throws Exception {
MavenRepository repository = MavenRepository.builder()
.id("html-based")
.uri("https://central.sonatype.com/repository/maven-snapshots")
.knownToExist(true)
.deriveMetadataIfMissing(true)
.build();
assertThrows(MavenDownloadingException.class, () ->
new MavenPomDownloader(emptyMap(), ctx).downloadMetadata(new GroupArtifact("does.definitely.not", "exist"), null, List.of(repository)));
}

@SuppressWarnings("ConstantConditions")
@Test
void mergeMetadata() throws Exception {
Expand Down