aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-09-07 22:18:51 +0200
committerGitHub <noreply@github.com>2022-09-07 21:18:51 +0100
commit8b8bdb30fbc522c38a35aad46a0036b926f5db9d (patch)
treee32834ea1c57c494f4ffa8fbf47ff624755321a2 /routers/api/packages
parentcb3b3e519f4689821476474214a49a8ae7cd4f58 (diff)
downloadgitea-8b8bdb30fbc522c38a35aad46a0036b926f5db9d.tar.gz
gitea-8b8bdb30fbc522c38a35aad46a0036b926f5db9d.zip
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
Diffstat (limited to 'routers/api/packages')
-rw-r--r--routers/api/packages/pypi/pypi.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/packages/pypi/pypi.go b/routers/api/packages/pypi/pypi.go
index 07cf766c61..3a046abe18 100644
--- a/routers/api/packages/pypi/pypi.go
+++ b/routers/api/packages/pypi/pypi.go
@@ -23,7 +23,7 @@ import (
// https://www.python.org/dev/peps/pep-0503/#normalized-names
var normalizer = strings.NewReplacer(".", "-", "_", "-")
-var nameMatcher = regexp.MustCompile(`\A[a-z0-9\.\-_]+\z`)
+var nameMatcher = regexp.MustCompile(`\A[a-zA-Z0-9\.\-_]+\z`)
// https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
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]*))?$`)