Written by Claude Opus 5.5 via Claude Code for the PyPI maintainers; I prompted it, it did the work, I read it.
Describe the bug
When adding a pending GitHub trusted publisher, a project name with a leading space ( cot-assert, pasted) is rejected with "Invalid project name" shown twice under the field. The German UI shows "Ungültiger Projektname". Nothing says what is wrong with the name. The name itself is valid: without the space it is accepted.
The message appears twice because two checks reject the same input: the Regexp(PROJECT_NAME_RE) validator on project_name, and validate_project_name, which calls _check_project_name and turns ProjectNameUnavailableInvalidError into the same message (warehouse/oidc/forms/_core.py, warehouse/packaging/services.py).
Expected behavior
Surrounding whitespace is stripped, as the GitHub form already does for workflow_filename (filters=[lambda x: x.strip() if x else x], warehouse/oidc/forms/github.py). Failing that, the message should name the rule the input broke, and show it once.
To Reproduce
- Account settings → Publishing → add a pending GitHub publisher.
- Enter
example-name (with a leading space) as the project name and fill in the other fields.
- Submit: "Invalid project name" appears twice, with no further detail.
My Platform
Web UI on pypi.org, German locale.
Additional context
The same filter probably belongs on the other pending-publisher text fields that are validated with a regex (owner, repository), since pasting there hits the same wall.
Written by Claude Opus 5.5 via Claude Code for the PyPI maintainers; I prompted it, it did the work, I read it.
Describe the bug
When adding a pending GitHub trusted publisher, a project name with a leading space (
cot-assert, pasted) is rejected with "Invalid project name" shown twice under the field. The German UI shows "Ungültiger Projektname". Nothing says what is wrong with the name. The name itself is valid: without the space it is accepted.The message appears twice because two checks reject the same input: the
Regexp(PROJECT_NAME_RE)validator onproject_name, andvalidate_project_name, which calls_check_project_nameand turnsProjectNameUnavailableInvalidErrorinto the same message (warehouse/oidc/forms/_core.py,warehouse/packaging/services.py).Expected behavior
Surrounding whitespace is stripped, as the GitHub form already does for
workflow_filename(filters=[lambda x: x.strip() if x else x],warehouse/oidc/forms/github.py). Failing that, the message should name the rule the input broke, and show it once.To Reproduce
example-name(with a leading space) as the project name and fill in the other fields.My Platform
Web UI on pypi.org, German locale.
Additional context
The same filter probably belongs on the other pending-publisher text fields that are validated with a regex (owner, repository), since pasting there hits the same wall.