lib/vagrant/action/builtin/box_add.rb in vagrant-unbundled-1.9.1.1 vs lib/vagrant/action/builtin/box_add.rb in vagrant-unbundled-1.9.5.1

- old
+ new

@@ -166,16 +166,19 @@ # them up. authenticated_url = url[1] url = url[0] end + display_original_url = Util::CredentialScrubber.scrub(Array(original_url).first) + display_url = Util::CredentialScrubber.scrub(url) + env[:ui].output(I18n.t( "vagrant.box_loading_metadata", - name: Array(original_url).first)) + name: display_original_url)) if original_url != url env[:ui].detail(I18n.t( - "vagrant.box_expanding_url", url: url)) + "vagrant.box_expanding_url", url: display_url)) end metadata = nil begin metadata_path = download( @@ -187,12 +190,12 @@ end rescue Errors::DownloaderError => e raise if !expanded raise Errors::BoxAddShortNotFound, error: e.extra_data[:message], - name: original_url, - url: url + name: display_original_url, + url: display_url ensure metadata_path.delete if metadata_path && metadata_path.file? end if env[:box_name] && metadata.name != env[:box_name] @@ -206,16 +209,16 @@ if !metadata_version if provider && !metadata.version(">= 0", provider: provider) raise Errors::BoxAddNoMatchingProvider, name: metadata.name, requested: provider, - url: url + url: display_url else raise Errors::BoxAddNoMatchingVersion, constraints: version || ">= 0", name: metadata.name, - url: url, + url: display_url, versions: metadata.versions.join(", ") end end metadata_provider = nil @@ -263,11 +266,11 @@ authed_urls = hook_env[:box_urls] if !authed_urls || authed_urls.length != 1 raise "Bad box authentication hook, did not generate proper results." end provider_url = authed_urls[0] - end + end box_add( [[provider_url, metadata_provider.url]], metadata.name, metadata_version.version, @@ -427,21 +430,22 @@ # path as an instance variable so that the `#recover` method can # access it. if opts[:ui] show_url = opts[:show_url] show_url ||= url + display_url = Util::CredentialScrubber.scrub(show_url) translation = "vagrant.box_downloading" # Adjust status message when 'downloading' a local box. if show_url.start_with?("file://") translation = "vagrant.box_unpacking" end env[:ui].detail(I18n.t( translation, - url: show_url)) + url: display_url)) if File.file?(d.destination) env[:ui].info(I18n.t("vagrant.actions.box.download.resuming")) end end @@ -472,9 +476,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) begin File.open(url, "r") do |f| if f.size > METADATA_SIZE_LIMIT # Quit early, don't try to parse the JSON of gigabytes