Actions
Issue #4904
closedpulp-file_client might be encoding request URLs incorrectly
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
API Bindings
Sprint:
Sprint 54
Quarter:
Description
While working with the latest pulp-file_client ruby gem we observed issues with URL formatting:
From the client side:
PulpFileClient::ApiError: Error message: the server returns an error
HTTP status code: 404
Response headers: {"Server"=>"nginx/1.12.2", "Date"=>"Mon, 03 Jun 2019 19:40:07 GMT", "Content-Type"=>"text/html", "Content-Length"=>"77", "Connection"=>"keep-alive", "X-Frame-Options"=>"SAMEORIGIN"}
Response body: <h1>Not Found</h1><p>The requested resource was not found on this server.</p>
/home/vagrant/projects/katello/app/lib/pulp/v3/api.rb:29:in `remotes_file_file_delete'
/home/vagrant/projects/katello/app/services/katello/pulp3/repository/file.rb:40:in `delete_remote'
/home/vagrant/projects/katello/test/support/pulp3_support.rb:26:in `ensure_creatable'
/home/vagrant/projects/katello/test/services/katello/pulp3/file_unit_test.rb:13:in `setup'
/home/vagrant/projects/katello/test/support/vcr.rb:24:in `block in run'
/home/vagrant/projects/katello/test/support/vcr.rb:23:in `run'
And on the pulp3 server side:
gunicorn[2934]: pulp: django.request:WARNING: Not Found: /%2Fpulp%2Fapi%2Fv3%2Fremotes%2Ffile%2Ffile%2F0bbe78bc-eea8-4103-bc2f-eede6a1c8c7a%2F
Related issues
Updated by jdjeffers over 5 years ago
Note the path is decoded as:
//pulp/api/v3/remotes/file/file/0bbe78bc-eea8-4103-bc2f-eede6a1c8c7a/
Updated by jsherril@redhat.com over 5 years ago
- Has duplicate Issue #4906: Cannot read remote using remotes_file_file_read method added
Updated by jdjeffers over 5 years ago
Forgot to mention this was discovered in pulp_file_client 3.0.0rc2.dev.1559507270
Updated by amacdona@redhat.com over 5 years ago
- Triaged changed from No to Yes
- Sprint set to Sprint 53
Updated by amacdona@redhat.com over 5 years ago
- Sprint changed from Sprint 53 to Sprint 54
Updated by jdjeffers over 5 years ago
Also observed in pulpcore_client 3.0.0rc2.dev.1559833395.
Updated by jdjeffers over 5 years ago
Here's an example of a debugger session:
[84, 93] in /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/pulpcore_client-3.0.0rc2.dev.1559833395/lib/pulpcore_client/api_client.rb
84: # @option opts [Hash] :query_params Query parameters
85: # @option opts [Hash] :form_params Query parameters
86: # @option opts [Object] :body HTTP body (JSON/XML)
87: # @return [Typhoeus::Request] A Typhoeus Request
88: def build_request(http_method, path, opts = {})
=> 89: url = build_request_url(path)
90: http_method = http_method.to_sym.downcase
91:
92: header_params = @default_headers.merge(opts[:header_params] || {})
93: query_params = opts[:query_params] || {}
(byebug) path
"%2Fpulp%2Fapi%2Fv3%2Frepositories%2F9be3daf5-0831-4b84-ab54-9b1b5ceffe16%2F"
(byebug) s
[258, 267] in /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/pulpcore_client-3.0.0rc2.dev.1559833395/lib/pulpcore_client/api_client.rb
258: filename.gsub(/.*[\/\\]/, '')
259: end
260:
261: def build_request_url(path)
262: # Add leading and trailing slashes to path
=> 263: path = "/#{path}".gsub(/\/+/, '/')
264: @config.base_url + path
265: end
266:
267: # Builds the HTTP request body
(byebug) path
"%2Fpulp%2Fapi%2Fv3%2Frepositories%2F9be3daf5-0831-4b84-ab54-9b1b5ceffe16%2F"
(byebug) n
[259, 268] in /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/pulpcore_client-3.0.0rc2.dev.1559833395/lib/pulpcore_client/api_client.rb
259: end
260:
261: def build_request_url(path)
262: # Add leading and trailing slashes to path
263: path = "/#{path}".gsub(/\/+/, '/')
=> 264: @config.base_url + path
265: end
266:
267: # Builds the HTTP request body
268: #
(byebug) path
"/%2Fpulp%2Fapi%2Fv3%2Frepositories%2F9be3daf5-0831-4b84-ab54-9b1b5ceffe16%2F"
Added by dkliban@redhat.com over 5 years ago
Updated by dkliban@redhat.com over 5 years ago
- Status changed from NEW to MODIFIED
Applied in changeset pulp-openapi-generator|7a4b64bb72a1adf2e3e9b5f8fa6937d8543006cb.
Updated by dkliban@redhat.com over 5 years ago
I pinned the version of openapi-generator-cli to 4.0.0, but I also filed an openapi-generator issue[0] to get it working again on master branch.
[0] https://github.com/OpenAPITools/openapi-generator/issues/3119
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Updated by bmbouter over 4 years ago
- Category deleted (
14)
We are removing the 'API' category per open floor discussion June 16, 2020.
Actions
Problem: ruby client is generated with encoded URL
Solution: ping version of openapi-generator-cli to v4.0.0
This version of openapi-generator does not have the patch that causes the encoding of the URL.
fixes: #4904 https://pulp.plan.io/issues/4904