Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uppercase characters in pypi packages names are not allowed for upload #21014

Closed
gd197 opened this issue Sep 1, 2022 · 2 comments · Fixed by #21095
Closed

Uppercase characters in pypi packages names are not allowed for upload #21014

gd197 opened this issue Sep 1, 2022 · 2 comments · Fixed by #21095

Comments

@gd197
Copy link

gd197 commented Sep 1, 2022

Description

Python packages with a character in uppercase cannot be uploaded in package registry.
eg : Pygments-2.13.0-py3-none-any.whl from pypi.org
or
PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl from pypi.org
lead to :
2022/09/01 08:57:24 ...ackages/pypi/pypi.go:34:func1() [T] [631057d4] plainTextInternal (status=400): invalid name or version
By changing the wheel file name and the name entry in METADATA file of the package by lowercase solve the issue.
could be related to :
routers/api/packages/pypi/pypi.go
var nameMatcher = regexp.MustCompile('\A[a-z0-9\.\-_]+\z')
sorry for not being in a situation currently to provide a correct (and tested) pull request but I'll work on it in the future

Gitea Version

1.17.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.27.0

Operating System

RHEL8.5

How are you running Gitea?

official github 1.17.1 delivery

Database

MySQL

@gd197 gd197 added the type/bug label Sep 1, 2022
@lunny lunny added this to the 1.17.2 milestone Sep 1, 2022
@lunny lunny modified the milestones: 1.17.2, 1.17.3 Sep 5, 2022
@KN4CK3R
Copy link
Member

KN4CK3R commented Sep 6, 2022

As per PEP 426 the only valid characters in a name are the ASCII alphabet, ASCII numbers, ., -, and _. The name should be lowercased with all runs of the characters ., -, or _ replaced with a single - character.

I misinterpreted the last sentence, uppercase characters are fine. Will send a PR.

zeripath pushed a commit that referenced this issue Sep 7, 2022
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
@gd197
Copy link
Author

gd197 commented Sep 20, 2022

I may be wrong but I do not see the PR backport in 1.17.3 despite in roadmap ?

KN4CK3R added a commit to KN4CK3R/gitea that referenced this issue Sep 20, 2022
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 go-gitea#21014
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants