checking whether the field location_uri.host is nil

This commit is contained in:
Thomas Röggla 2018-07-12 15:49:26 +02:00
parent 1f99da7a11
commit 2613d620fd
1 changed files with 11 additions and 8 deletions

View File

@ -107,8 +107,10 @@ module Vagrant
if progress_data.include?("Location")
location = progress_data.scan(/Location: (.+?)$/m).flatten.compact.first.to_s.strip
if !location.empty?
@logger.info("download redirected to #{location}")
location_uri = URI.parse(location)
unless location_uri.host.nil?
@logger.info("download redirected to #{location}")
source_uri = URI.parse(source)
source_host = source_uri.host.split(".", 2).last
location_host = location_uri.host.split(".", 2).last
@ -118,6 +120,7 @@ module Vagrant
end
@redirect_notify = true
end
end
progress_data.replace("")
break
end