Bug #14704
openCan't search external registry if username/password contains special char
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1328082
Description of problem:
Can't search a image/tag using an external registry if username/password contains special char. It seems that username/password is not URLEncoded when used.
Version-Release number of selected component (if applicable):
@Sat6.2.0-Beta-Snap8
How reproducible:
always
Steps to Reproduce:
1. Create an external registry using URL https://registry.access.redhat.com and username/password containing special char, e.g. '@', '%'
2. Go to New Container wizard and select an already created docker compute resouce
3. In the next step select the "External Registry" tab, search for 'rhel'
(x) Oops, we're sorry but something went wrong bad component(expected userinfo component or user component): q%r
Actual results:
No search results, an error message pop-up shown
Expected results:
Search results without errors.
Additional info:
2016-04-18 08:00:49 [app] [I] Started GET "/image_search/2/search_repository?search=rhel®istry_id=2" for <CLIENT_IP> at 2016-04-18 08:00:49 -0400
2016-04-18 08:00:49 [app] [I] Processing by ImageSearchController#search_repository as TEXT
2016-04-18 08:00:49 [app] [I] Parameters: {"search"=>"rhel", "registry_id"=>"2", "id"=>"2"}
2016-04-18 08:00:49 [app] [W] Action failed
| URI::InvalidComponentError: bad component(expected userinfo component or user component): q%r
| /opt/rh/rh-ruby22/root/usr/share/ruby/uri/generic.rb:400:in `check_user'
| /opt/rh/rh-ruby22/root/usr/share/ruby/uri/generic.rb:472:in `user='
| /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/models/service/registry_api.rb:9:in `initialize'
| /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:110:in `new'
| /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:110:in `registry_search_image'
| /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:42:in `block in search_repository'
| /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:56:in `catch_network_errors'
| /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:38:in `search_repository'
| /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
| /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/abstract_controller/base.rb:189:in `process_action'
| /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/rendering.rb:10:in `process_action'
...
2016-04-18 08:00:49 [app] [I] Rendered common/500.html.erb (1.1ms)
2016-04-18 08:00:49 [app] [I] Completed 500 Internal Server Error in 12ms (Views: 1.5ms | ActiveRecord: 2.4ms)
No data to display