summaryrefslogtreecommitdiff
path: root/lib/bundler/fetcher.rb
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2013-02-18 21:41:38 -0800
committerAndre Arko <andre@arko.net>2013-02-18 21:41:38 -0800
commitbfc0632ff891a9c33cf3caf3cae34d47875f8baf (patch)
tree12ef5acf55cb83a685ce86b698e80bf82f058b8d /lib/bundler/fetcher.rb
parent332cd2f9dfab04e49330eac20ba8a0e3a3984c3b (diff)
downloadbundler-bfc0632ff891a9c33cf3caf3cae34d47875f8baf.tar.gz
abstract Marshal.load failures
Diffstat (limited to 'lib/bundler/fetcher.rb')
-rw-r--r--lib/bundler/fetcher.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 9036b0ecd5..ebbf0b7725 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -83,7 +83,10 @@ module Bundler
uri = URI.parse("#{@remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}")
spec_rz = (uri.scheme == "file") ? Gem.read_binary(uri.path) : fetch(uri)
- Marshal.load Gem.inflate(spec_rz)
+ Bundler.load_marshal Gem.inflate(spec_rz)
+ rescue MarshalError => e
+ raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
+ "Your network or your gem server is probably having issues right now."
end
# return the specs in the bundler format as an index
@@ -143,9 +146,9 @@ module Bundler
fetch_remote_specs(deps_list, full_dependency_list + returned_gems, spec_list + last_spec_list)
# fall back to the legacy index in the following cases
# 1. Gemcutter Endpoint doesn't return a 200
- # 2,3. Marshal blob doesn't load properly
- # 4. One of the YAML gemspecs has the Syck::DefaultKey problem
- rescue HTTPError, ArgumentError, TypeError, GemspecError => e
+ # 2. Marshal blob doesn't load properly
+ # 3. One of the YAML gemspecs has the Syck::DefaultKey problem
+ rescue HTTPError, MarshalError, GemspecError => e
@use_api = false
# new line now that the dots are over
@@ -226,7 +229,7 @@ module Bundler
def fetch_dependency_remote_specs(gem_names)
Bundler.ui.debug "Query Gemcutter Dependency Endpoint API: #{gem_names.join(',')}"
marshalled_deps = fetch dependency_api_uri(gem_names)
- gem_list = Marshal.load(marshalled_deps)
+ gem_list = Bundler.load_marshal(marshalled_deps)
deps_list = []
spec_list = gem_list.map do |s|