lib/vagrant/action/builtin/box_add.rb in vagrant-unbundled-2.2.9.0 vs lib/vagrant/action/builtin/box_add.rb in vagrant-unbundled-2.2.10.0

- old
+ new

@@ -23,10 +23,11 @@ RESUME_DELAY = 24 * 60 * 60 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant::action::builtin::box_add") + @parser = URI::RFC2396_Parser.new end def call(env) @download_interrupted = false @@ -42,22 +43,22 @@ url = Array(env[:box_url]).map do |u| u = u.gsub("\\", "/") if Util::Platform.windows? && u =~ /^[a-z]:/i # On Windows, we need to be careful about drive letters - u = "file:///#{URI.escape(u)}" + u = "file:///#{@parser.escape(u)}" end if u =~ /^[a-z0-9]+:.*$/i && !u.start_with?("file://") # This is not a file URL... carry on next u end # Expand the path and try to use that, if possible - p = File.expand_path(URI.unescape(u.gsub(/^file:\/\//, ""))) + p = File.expand_path(@parser.unescape(u.gsub(/^file:\/\//, ""))) p = Util::Platform.cygwin_windows_path(p) - next "file://#{URI.escape(p.gsub("\\", "/"))}" if File.file?(p) + next "file://#{@parser.escape(p.gsub("\\", "/"))}" if File.file?(p) u end # If we received a shorthand URL ("mitchellh/precise64"), @@ -432,11 +433,11 @@ downloader_options[:client_cert] = env[:box_download_client_cert] downloader_options[:headers] = ["Accept: application/json"] if opts[:json] downloader_options[:ui] = env[:ui] if opts[:ui] downloader_options[:location_trusted] = env[:box_download_location_trusted] downloader_options[:box_extra_download_options] = env[:box_extra_download_options] - + Util::Downloader.new(url, temp_path, downloader_options) end def download(url, env, **opts) opts[:ui] = true if !opts.key?(:ui) @@ -493,10 +494,10 @@ if uri.scheme == "file" url = uri.path url ||= uri.opaque #7570 Strip leading slash left in front of drive letter by uri.path Util::Platform.windows? && url.gsub!(/^\/([a-zA-Z]:)/, '\1') - url = URI.unescape(url) + url = @parser.unescape(url) begin File.open(url, "r") do |f| if f.size > METADATA_SIZE_LIMIT # Quit early, don't try to parse the JSON of gigabytes