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

Closed
opened 2025-11-02 08:40:38 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @gd197 on GitHub (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

Originally created by @gd197 on GitHub (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](https://pypi.org/project/Pygments/#files) or PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl from [pypi.org](https://pypi.org/project/PyQt5-Qt5/#files) 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
GiteaMirror added the topic/packagestype/bug labels 2025-11-02 08:40:38 -06:00
Author
Owner

@KN4CK3R commented on GitHub (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.

@KN4CK3R commented on GitHub (Sep 6, 2022): > As per [PEP 426](https://peps.python.org/pep-0426) 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.
Author
Owner

@gd197 commented on GitHub (Sep 20, 2022):

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

@gd197 commented on GitHub (Sep 20, 2022): I may be wrong but I do not see the PR backport in 1.17.3 despite in roadmap ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9494