Skip to content

Commit 29c5e70

Browse files
dgwdi
andauthored
Add package version support to /p/ shortlink routing (#17593)
Co-authored-by: Dustin Ingram <[email protected]>
1 parent a8dd637 commit 29c5e70

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tests/unit/test_routes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,9 @@ def add_redirect_rule(*args, **kwargs):
675675
pretend.call("/u/{username}/", "/user/{username}/", domain=warehouse),
676676
pretend.call("/2fa/", "/manage/account/two-factor/", domain=warehouse),
677677
pretend.call("/p/{name}/", "/project/{name}/", domain=warehouse),
678+
pretend.call(
679+
"/p/{name}/{version}/", "/project/{name}/{version}/", domain=warehouse
680+
),
678681
pretend.call("/pypi/{name}/", "/project/{name}/", domain=warehouse),
679682
pretend.call(
680683
"/pypi/{name}/{version}/", "/project/{name}/{version}/", domain=warehouse

warehouse/routes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ def includeme(config):
517517

518518
# Packaging
519519
config.add_redirect("/p/{name}/", "/project/{name}/", domain=warehouse)
520+
config.add_redirect(
521+
"/p/{name}/{version}/", "/project/{name}/{version}/", domain=warehouse
522+
)
520523
config.add_route(
521524
"packaging.project",
522525
"/project/{name}/",

0 commit comments

Comments
 (0)