Skip to content
Open
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
8 changes: 6 additions & 2 deletions internal/handler/maven.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ func (h *MavenHandler) parsePath(urlPath string) (group, artifact, version, file

// isArtifactFile returns true if the filename looks like a Maven artifact.
func (h *MavenHandler) isArtifactFile(filename string) bool {
// Common artifact extensions
extensions := []string{".jar", ".war", ".ear", ".pom", ".aar", ".klib", ".module"}
// Common artifact extensions, and the archives distributions such as
// apache-maven-{version}-bin.tar.gz are published as.
extensions := []string{
".jar", ".war", ".ear", ".pom", ".aar", ".klib", ".module",
".zip", ".tar.gz", ".tgz", ".tar.bz2", ".tar.xz",
}
for _, ext := range extensions {
if strings.HasSuffix(filename, ext) {
return true
Expand Down
4 changes: 4 additions & 0 deletions internal/handler/maven_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ func TestMavenIsArtifactFile(t *testing.T) {
{"guava-32.1.3-jre.module", true},
{"app-1.0.war", true},
{"lib-1.0.aar", true},
{"apache-maven-3.9.9-bin.tar.gz", true},
{"apache-maven-3.9.9-bin.zip", true},
{"maven-mvnd-1.0.6-linux-amd64.tgz", true},
{"maven-metadata.xml", false},
{"guava-32.1.3-jre.jar.sha1", false},
{"apache-maven-3.9.9-bin.tar.gz.sha512", false},
}

for _, tt := range tests {
Expand Down
Loading