mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
fix(pypi): serve pip's PEP 658 metadata requests
pip builds the PEP 658 URL by appending .metadata to the whole link, so the suffix lands on original_url, not the path. The filename binding from GH-01 then rejected the request with 400, and every pip install through the proxy failed. The handler now treats that form as the requested wheel's sidecar and streams it without storing it. A sidecar of another file is still refused. The Lean model and the ledger cover the new form (GH-23).
This commit is contained in:
@@ -288,6 +288,11 @@ func (h *Handler) handlePackageFile(ctx context.Context, w http.ResponseWriter,
|
||||
parsed.RawPath = ""
|
||||
originalURL = parsed.String()
|
||||
}
|
||||
// pip appends ".metadata" to the whole link, so the suffix lands on original_url, not the path.
|
||||
if !isSidecar && gopath.Base(parsed.Path) == filename+metadataSuffix {
|
||||
isSidecar = true
|
||||
filename += metadataSuffix
|
||||
}
|
||||
if !isAllowedPyPIHost(parsed.Host, h.allowedHosts) {
|
||||
log.Warn().
|
||||
Str("original_url", originalURL).
|
||||
|
||||
Reference in New Issue
Block a user