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

Use packaging.metadata to parse and validate upload metadata (Second try) #15631

Merged
merged 6 commits into from
Mar 19, 2024

Conversation

di
Copy link
Member

@di di commented Mar 19, 2024

This reverts #15630, bringing back #14718.

Fixes #15628, #14718 (comment) and WAREHOUSE-PRODUCTION-1R3.

The fixes are:

  • bf1f041 - meta.version returns a packaging.version.Version, but our async task requires all args to be strings to serialize as JSON, so cast it to a string.
  • 101c6a5 - When metadata fields are missing for an artifact, twine sends empty strings, but empty strings are never valid metadata field values, and fail metadata validation when we pass this to packaging.metadata.Metadata. Therefore, when pre-parsing metadata from POST bodies, we drop all fields with empty string values.

@di di requested a review from a team as a code owner March 19, 2024 15:54
@di di merged commit f5b1ef3 into pypi:main Mar 19, 2024
17 checks passed
@di di deleted the revert/15630 branch March 19, 2024 21:55
javanlacerda pushed a commit to javanlacerda/warehouse that referenced this pull request Mar 25, 2024
…try) (pypi#15631)

* Revert "Revert "Use packaging.metadata to parse and validate upload metadata (pypi#14718)" (pypi#15630)"

This reverts commit 7b00f6b.

* Cast version to string when enqueueing task

Fixes WAREHOUSE-PRODUCTION-1R3.

* Ignore empty string values when parsing metadata

* Add test coverage
miketheman added a commit to miketheman/warehouse that referenced this pull request Aug 28, 2024
We get `email-validator` from `wtforms`, but use it explicitly in our
own code, so declare it a direct dependency in case `wtforms` ever drops
it.

Refs: pypi#15631

Signed-off-by: Mike Fiedler <[email protected]>
miketheman added a commit to miketheman/warehouse that referenced this pull request Aug 29, 2024
We get `email-validator` from `wtforms`, but use it explicitly in our
own code, so declare it a direct dependency in case `wtforms` ever drops
it.

Refs: pypi#15631

Signed-off-by: Mike Fiedler <[email protected]>
miketheman added a commit to miketheman/warehouse that referenced this pull request Sep 9, 2024
We get `email-validator` from `wtforms`, but use it explicitly in our
own code, so declare it a direct dependency in case `wtforms` ever drops
it.

Refs: pypi#15631

Signed-off-by: Mike Fiedler <[email protected]>
miketheman added a commit to miketheman/warehouse that referenced this pull request Sep 11, 2024
We get `email-validator` from `wtforms`, but use it explicitly in our
own code, so declare it a direct dependency in case `wtforms` ever drops
it.

Refs: pypi#15631

Signed-off-by: Mike Fiedler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uploading to PyPi Response from https://upload.pypi.org/legacy/: 400 '' is not a valid url
2 participants