Permalink
Browse files

Fix URI exception by encoding gem names for rubygems dependency API #…

  • Loading branch information...
1 parent 66f4249 commit d49f78b141ef99107facb3bba6728e66783e2919 @rohit rohit committed with indirect Mar 11, 2012
Showing with 12 additions and 1 deletion.
  1. +2 −1 lib/bundler/fetcher.rb
  2. +10 −0 spec/install/gems/dependency_api_spec.rb
View
3 lib/bundler/fetcher.rb
@@ -158,7 +158,8 @@ def fetch(uri, counter = 0)
# fetch from Gemcutter Dependency Endpoint API
def fetch_dependency_remote_specs(gem_names)
Bundler.ui.debug "Query Gemcutter Dependency Endpoint API: #{gem_names.join(' ')}"
- uri = URI.parse("#{@remote_uri}api/v1/dependencies?gems=#{gem_names.join(",")}")
+ encoded_gem_names = URI.encode(gem_names.join(","))
+ uri = URI.parse("#{@remote_uri}api/v1/dependencies?gems=#{encoded_gem_names}")
marshalled_deps = fetch(uri)
gem_list = Marshal.load(marshalled_deps)
deps_list = []
View
10 spec/install/gems/dependency_api_spec.rb
@@ -14,6 +14,16 @@
should_be_installed "rack 1.0.0"
end
+ it "should URI encode gem names" do
+ gemfile <<-G
+ source "#{source_uri}"
+ gem " sinatra"
+ G
+
+ bundle :install, :artifice => "endpoint"
+ out.should include("Could not find gem ' sinatra")
+ end
+
it "should handle nested dependencies" do
gemfile <<-G
source "#{source_uri}"

0 comments on commit d49f78b

Please sign in to comment.