From 80bfb66a0e703259ad4c1f09d991736f04e8a23a Mon Sep 17 00:00:00 2001 From: Giles Westwood <201443+gilesw@users.noreply.github.com> Date: Thu, 8 Oct 2026 22:04:57 +0100 Subject: [PATCH] Cache archive artifacts from Maven repositories The Maven handler cached only .jar, .war, .ear, .pom, .aar, .klib and .module files, so distributions published as archives, such as apache-maven-{version}-bin.tar.gz, were proxied uncached on every request. .zip, .tar.gz, .tgz, .tar.bz2 and .tar.xz files now go through the artifact cache like other artifacts. --- internal/handler/maven.go | 8 ++++++-- internal/handler/maven_test.go | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/handler/maven.go b/internal/handler/maven.go index 3f1cd9d1..850cec3c 100644 --- a/internal/handler/maven.go +++ b/internal/handler/maven.go @@ -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 diff --git a/internal/handler/maven_test.go b/internal/handler/maven_test.go index 9ca5eb63..9331a003 100644 --- a/internal/handler/maven_test.go +++ b/internal/handler/maven_test.go @@ -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 {