Commit edaf9dd0 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Downloader::Request] Use a hex digest of downloader options

This way, we never exceed file length limits
parent fde74d05
require 'digest'
module Pod module Pod
module Downloader module Downloader
# This class represents a download request for a given Pod. # This class represents a download request for a given Pod.
...@@ -65,8 +67,9 @@ module Pod ...@@ -65,8 +67,9 @@ module Pod
if released_pod? if released_pod?
"Release/#{name}/#{spec.version}#{checksum}" "Release/#{name}/#{spec.version}#{checksum}"
else else
opts = params.to_a.sort_by(&:first).map { |k, v| "#{k}=#{v}" }.join('-').gsub(/(#{Regexp.escape File::SEPARATOR})+/, '+') opts = params.to_a.sort_by(&:first).map { |k, v| "#{k}=#{v}" }.join('-')
"External/#{name}/#{opts}#{checksum}" digest = Digest::MD5.hexdigest(opts)
"External/#{name}/#{digest}#{checksum}"
end end
end end
......
...@@ -74,7 +74,7 @@ module Pod ...@@ -74,7 +74,7 @@ module Pod
end end
it 'returns the slug' do it 'returns the slug' do
@request.slug.should == 'External/BananaLib/git=http:+banana-corp.local+banana-lib.git-tag=v1.0' @request.slug.should == 'External/BananaLib/a0856313adccfbcc7c5b0ea859ee14f5'
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment