Skip to content

Commit 8b8bdb3

Browse files
authored
Allow uppercase ASCII alphabet in PyPI package names (#21095)
The PyPI name regexp is too restrictive and only permits lowercase characters. This PR adjusts the regexp to add in support for uppercase characters. Fix #21014
1 parent cb3b3e5 commit 8b8bdb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/api/packages/pypi/pypi.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
// https://www.python.org/dev/peps/pep-0503/#normalized-names
2525
var normalizer = strings.NewReplacer(".", "-", "_", "-")
26-
var nameMatcher = regexp.MustCompile(`\A[a-z0-9\.\-_]+\z`)
26+
var nameMatcher = regexp.MustCompile(`\A[a-zA-Z0-9\.\-_]+\z`)
2727

2828
// https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
2929
var versionMatcher = regexp.MustCompile(`^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$`)

0 commit comments

Comments
 (0)