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
checksum = (env[:box_checksum] || "").to_s
checksum_klass = case env[:box_checksum_type].to_sym
when nil
nil
when :md5
Digest::MD5
when :sha1
Digest::SHA1
when :sha256
Digest::SHA2
else
raise Errors::BoxChecksumInvalidType,
type: env[:box_checksum_type].to_s
checksum_klass = nil
if env[:box_checksum_type]
checksum_klass = case env[:box_checksum_type].to_sym
when :md5
Digest::MD5
when :sha1
Digest::SHA1
when :sha256
Digest::SHA2
else
raise Errors::BoxChecksumInvalidType,
type: env[:box_checksum_type].to_s
end
end
# Go through each URL and attempt to download it