core: fix exception when checksum type is nil

Thanks @johnbellone
This commit is contained in:
Mitchell Hashimoto 2013-12-03 18:52:44 -08:00
parent e83070371d
commit 0a43cf2b6f
1 changed files with 13 additions and 12 deletions

View File

@ -21,18 +21,19 @@ module Vagrant
# Determine the checksum type to use # Determine the checksum type to use
checksum = (env[:box_checksum] || "").to_s checksum = (env[:box_checksum] || "").to_s
checksum_klass = case env[:box_checksum_type].to_sym checksum_klass = nil
when nil if env[:box_checksum_type]
nil checksum_klass = case env[:box_checksum_type].to_sym
when :md5 when :md5
Digest::MD5 Digest::MD5
when :sha1 when :sha1
Digest::SHA1 Digest::SHA1
when :sha256 when :sha256
Digest::SHA2 Digest::SHA2
else else
raise Errors::BoxChecksumInvalidType, raise Errors::BoxChecksumInvalidType,
type: env[:box_checksum_type].to_s type: env[:box_checksum_type].to_s
end
end end
# Go through each URL and attempt to download it # Go through each URL and attempt to download it