diff --git a/CHANGELOG.md b/CHANGELOG.md index aec6d605a..cd9162efe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ BUG FIXES: - core: private networks with DHCP type work if type parameter is a string and not a symbol. [GH-3349] - core: Converting to cygwin path works for folders with spaces. [GH-3304] + - core: Can add boxes with spaces in their path. [GH-3306] - commands/box: Show versions when listing. [GH-3316] - commands/status: Machine readable output contains the target. [GH-3218] - guests/arch: Reload udev rules after network change. [GH-3322] diff --git a/lib/vagrant/action/builtin/box_add.rb b/lib/vagrant/action/builtin/box_add.rb index 588ada093..c7c669bcc 100644 --- a/lib/vagrant/action/builtin/box_add.rb +++ b/lib/vagrant/action/builtin/box_add.rb @@ -30,7 +30,7 @@ module Vagrant u = u.gsub("\\", "/") if Util::Platform.windows? && u =~ /^[a-z]:/i # On Windows, we need to be careful about drive letters - u = "file://#{u}" + u = "file://#{URI.escape(u)}" end if u =~ /^[a-z0-9]+:.*$/i && !u.start_with?("file://") @@ -39,9 +39,9 @@ module Vagrant end # Expand the path and try to use that, if possible - p = File.expand_path(u.gsub(/^file:\/\//, "")) + p = File.expand_path(URI.unescape(u.gsub(/^file:\/\//, ""))) p = Util::Platform.cygwin_windows_path(p) - next "file://#{p.gsub("\\", "/")}" if File.file?(p) + next "file://#{URI.escape(p.gsub("\\", "/"))}" if File.file?(p) u end