mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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
This commit is contained in:
		@@ -23,7 +23,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// https://www.python.org/dev/peps/pep-0503/#normalized-names
 | 
					// https://www.python.org/dev/peps/pep-0503/#normalized-names
 | 
				
			||||||
var normalizer = strings.NewReplacer(".", "-", "_", "-")
 | 
					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
 | 
					// 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]*))?$`)
 | 
					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]*))?$`)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user