CLI does not send the file name in the form data on file uploads.
Closed this issue · 5 comments
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"
What is the actual bug here? What does not work when doing it this way?
Sorry, wrong button.
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
And how come we didn't see this earlier?
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.