Repository navigation
Conversation
handleDownload only 404'd an unparseable path when it had four or more segments, so a file such as bar/1.0/bar-1.0.jar was proxied without caching and skipped the denylist, the scan and the cooldown. Nothing in the Maven layout is shorter than a coordinate, so any path it cannot parse now gets the same 404, and the test for paths outside the layout covers the short ones. Closes git-pkgs#686.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
simonchrz
left a comment
There was a problem hiding this comment.
This also turns some short checksum files that exist upstream into 404s. handleRequest sends every .sha1/.md5/... file to handleDownload, however short the path, and checksums of non-coordinate files can't be parsed either. Two that are on Maven Central:
/archetype-catalog.xml.sha1(and.md5)/.index/nexus-maven-repository-index.gz.sha1
On main both are proxied and return 200; with this change they return 404. I checked with a small test using mavenRepoUpstream and newMavenRepositoriesHandler.
One way to keep them: answer 404 for an unparsable path only when the file is an artifact (isArtifactFile), a checksum or signature of one (the name minus its checksum suffix passes isArtifactFile), or a coordinate file, and keep proxying the rest. A case for /archetype-catalog.xml.sha1 in the existing fallback test would cover it.
MavenHandler.handleDownloadanswered 404 for a pathparsePathcould not read only when the path had four or more segments, sobar/1.0/bar-1.0.jarwas proxied uncached: past the denylist, the pre-cache scan and the cooldown. The layout has no shorter path, so the count is gone, andTestMavenDottedGroupDirectoryNotCachedAsGroupnow covers/bar/1.0/bar-1.0.jarand/bar-1.0.jar.The suite is green with the race detector, and reverting the change makes both short paths return 200. A short file with an extension no Maven file has (
/bar/1.0/bar-1.0.exe) is matched byisCoordinateFileand still proxied uncached — outside this issue, say if you want it here.Closes #686.
Summary by CodeRabbit