Skip to content

Commit

Permalink
Fix path with contained query
Browse files Browse the repository at this point in the history
Query inside path is not allowed, it should be under
separate key :query.

Putting query inside path leads to error:

URI::InvalidComponentError Exception: bad
component(expected absolute path component):
/v1.1/images/detail?limit=20

Caused most probably by this comparison:
URI::parser.regexp[:ABS_PATH] !~ v
  • Loading branch information
Ladas committed Dec 11, 2014
1 parent 418fd8f commit cc04c7f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/fog/openstack/requests/image/list_public_images_detailed.rb
Expand Up @@ -3,16 +3,18 @@ module Image
class OpenStack
class Real
def list_public_images_detailed(attribute=nil, query=nil)
path = 'images/detail'
if attribute
path = "images/detail?#{attribute}=#{URI::encode(query)}"
query = { attribute => URI::encode(query) }
else
path = 'images/detail'
query = {}
end

request(
:expects => [200, 204],
:method => 'GET',
:path => path
:path => path,
:query => query
)
end
end # class Real
Expand All @@ -23,8 +25,8 @@ def list_public_images_detailed(attribute=nil, query=nil)
response.status = [200, 204][rand(1)]
response.body = {'images' => self.data[:images].values}
response
end # def list_tenants
end # def list_public_images_detailed
end # class Mock
end # class OpenStack
end # module Identity
end # module Image
end # module Fog

0 comments on commit cc04c7f

Please sign in to comment.