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

CLI does not send the file name in the form data on file uploads. #842

Closed
gerrod3 opened this issue Dec 5, 2023 · 5 comments · Fixed by #843
Closed

CLI does not send the file name in the form data on file uploads. #842

gerrod3 opened this issue Dec 5, 2023 · 5 comments · Fixed by #843
Labels
bug Something isn't working (template-set)

Comments

@gerrod3
Copy link
Contributor

gerrod3 commented Dec 5, 2023

Summary

When serializing the request body for an upload, openapi.py does not specify the file name in the upload tuple (filename, file_data, content_type)

Steps to reproduce

Perform a file upload with -vvv and look at the filename for the file field, it'll probably be 'file' (the name of the upload file used by the api)

(pulp) [gerrod@localhost pulp_ansible]$ pulp -vvv ansible content upload --file pulp-squeezer-0.0.9.tar.gz
upload_collection : post http://localhost:5001/ansible/collections/
  User-Agent: Pulp-CLI/0.22.0.dev
  Accept-Encoding: gzip, deflate
  Accept: application/json
  Connection: keep-alive
  Content-Length: 36993
  Content-Type: multipart/form-data; boundary=94544652e2e7dcd9cf857ec97c99bb6d
  Authorization: Basic YWRtaW46cGFzc3dvcmQ=
b'--94544652e2e7dcd9cf857ec97c99bb6d\r\nContent-Disposition: form-data; name="file"; filename="file"
@gerrod3 gerrod3 added bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg labels Dec 5, 2023
gerrod3 added a commit to gerrod3/pulp-cli that referenced this issue Dec 5, 2023
@mdellweg
Copy link
Member

mdellweg commented Dec 5, 2023

What is the actual bug here? What does not work when doing it this way?

@mdellweg
Copy link
Member

mdellweg commented Dec 5, 2023

Sorry, wrong button.

@mdellweg mdellweg reopened this Dec 5, 2023
@gerrod3
Copy link
Contributor Author

gerrod3 commented Dec 5, 2023

Endpoints that parse the filename of the uploaded file like we do in ansible: https://github.com/pulp/pulp_ansible/blob/main/pulp_ansible/app/serializers.py#L483-L485

@mdellweg mdellweg removed the Triage-Needed Needs to be reviewed at next pulp-cli mtg label Dec 5, 2023
@mdellweg
Copy link
Member

mdellweg commented Dec 5, 2023

And how come we didn't see this earlier?

@gerrod3
Copy link
Contributor Author

gerrod3 commented Dec 6, 2023

We haven't seen this earlier because I set up ansible collection upload to use the endpoint with the least validation, which I happen to deprecate in pulp_ansible 0.16 (pulp/pulp_ansible#1176). I'm going to submit a PR to switch collection uploads to use the pulp v3 api instead.

gerrod3 added a commit to gerrod3/pulp-cli that referenced this issue Dec 6, 2023
gerrod3 added a commit to gerrod3/pulp-cli that referenced this issue Dec 6, 2023
mdellweg pushed a commit that referenced this issue Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (template-set)
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants