core: can add boxes with spaces in paths [GH-3306]

This commit is contained in:
Mitchell Hashimoto 2014-04-01 22:18:37 -07:00
parent d45eb1f183
commit 666b270e0b
2 changed files with 4 additions and 3 deletions

View File

@ -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]

View File

@ -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