Skip to content

Commit 42b3ccd

Browse files
dirndi
authored andcommitted
Add a shortlink for projects (#3165)
To make it easier for people who want to type project URLs, this will redirect all requests for `/p/<project>/` to `/project/<project>/`. Closes #3143 Signed-off-by: Andy Dirnberger <[email protected]>
1 parent c8ed765 commit 42b3ccd

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

tests/unit/test_routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def add_policy(name, filename):
269269
]
270270

271271
assert config.add_redirect.calls == [
272+
pretend.call("/p/{name}/", "/project/{name}/", domain=warehouse),
272273
pretend.call("/pypi/{name}/", "/project/{name}/", domain=warehouse),
273274
pretend.call(
274275
"/pypi/{name}/{version}/",

warehouse/routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def includeme(config):
178178
)
179179

180180
# Packaging
181+
config.add_redirect('/p/{name}/', '/project/{name}/', domain=warehouse)
181182
config.add_route(
182183
"packaging.project",
183184
"/project/{name}/",

0 commit comments

Comments
 (0)