Skip to content

Commit d12e7d9

Browse files
committed
WIP /packages/
1 parent 5f7586d commit d12e7d9

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

pulp_python/app/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from logging import getLogger
44
from pathlib import PurePath
55

6-
from aiohttp.web import json_response
6+
from aiohttp.web import HTTPFound, json_response
77
from django.conf import settings
88
from django.contrib.postgres.fields import ArrayField
99
from django.core.exceptions import ObjectDoesNotExist
@@ -91,6 +91,9 @@ def content_handler(self, path):
9191
name = path.parts[1]
9292
elif path.match("pypi/*/json"):
9393
name = path.parts[1]
94+
elif len(path.parts) >= 2 and path.parts[0] == "packages":
95+
filename = "/".join(path.parts[1:])
96+
raise HTTPFound(location=f"../{filename}") # 302
9497
elif len(path.parts) and path.parts[0] == "simple":
9598
# Temporary fix for PublishedMetadata not being properly served from remote storage
9699
# https://github.com/pulp/pulp_python/issues/413

pulp_python/app/pypi/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def retrieve(self, request, path, package):
390390
local_releases = {
391391
p["filename"]: {
392392
**p,
393-
"url": urljoin(self.base_content_url, f"{path}/{p['filename']}"),
393+
"url": urljoin(self.base_content_url, f"{path}/packages/{p['filename']}"),
394394
"upload_time": p["repo_added_time"],
395395
"provenance": (
396396
self.get_provenance_url(normalized, p["version"], p["filename"])

0 commit comments

Comments
 (0)