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

Upload API should accept signature files as separate requests #12629

Closed
di opened this issue Nov 30, 2022 · 0 comments · Fixed by #13707
Closed

Upload API should accept signature files as separate requests #12629

di opened this issue Nov 30, 2022 · 0 comments · Fixed by #13707

Comments

@di
Copy link
Member

di commented Nov 30, 2022

What's the problem this feature will solve?
Currently, signatures are required to be uploaded as part of the POST request for a given distribution file, rather than as separate files:

# Also buffer the entire signature file to disk.
if "gpg_signature" in request.POST:
has_signature = True
with open(os.path.join(tmpdir, filename + ".asc"), "wb") as fp:
signature_size = 0
for chunk in iter(
lambda: request.POST["gpg_signature"].file.read(8096), b""
):
signature_size += len(chunk)
if signature_size > MAX_SIGSIZE:
raise _exc_with_message(HTTPBadRequest, "Signature too large.")
fp.write(chunk)

This leads to confusion when users are attempting to upload distribution files and signatures as separate invocations, such as pypa/twine#931.

Describe the solution you'd like
The upload endpoint should accept signature files as separate requests, rather than as part of a POST request for a distribution file that it corresponds to.

Additional context
An 'upload 2.0' API is described in https://peps.python.org/pep-0694/, but has the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant