plugins/commands/cloud/util.rb in vagrant-unbundled-2.2.14.0 vs plugins/commands/cloud/util.rb in vagrant-unbundled-2.2.16.0

- old
+ new

@@ -3,11 +3,19 @@ module Util # @return [String] Vagrant Cloud server URL def api_server_url if Vagrant.server_url == Vagrant::DEFAULT_SERVER_URL return "#{Vagrant.server_url}/api/v1" - else - return Vagrant.server_url + end + begin + addr = URI.parse(Vagrant.server_url) + if addr.path.empty? || addr.path.to_s == "/" + addr.path = "/api/v1" + end + + addr.to_s + rescue URI::Error + Vagrant.server_url end end # @param [Vagrant::Environment] env # @param [Hash] options