Skip to content

Auto-fill missing leading 0s in URL #2420

Closed
@ezio-melotti

Description

@ezio-melotti

I was going to add pep-* autolinking to the python/cpython repo, but I realized that the URL requires the right amount of leading 0 in order to work. For example:
https://peps.python.org/pep-0008/ -- works fine
https://peps.python.org/pep-8/ -- fails

People rarely mention the leading 0s when they write e.g. PEP-8 in a message, and the autolinker doesn't offer any formatting option. Because of this, clicking the link results in a 404.

Would it be possible to create a script that, in case of 404, tries to extract the pep number and redirects to f'https://peps.python.org/pep-{num:04d}/'?

If it's handled on this end, it will have the advantage that every repo will be able to autolink PEPs, and it will also work for people editing the URL manually (something I happen to do from time to time).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementinfraCore infrastructure for building and rendering PEPs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions