diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b3974ea0..b0ac012f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ IMPROVEMENTS / BUG FIXES: using SCP to upload files. [GH-924] - Box adding doesn't use `/tmp` anymore which can avoid some cross-device copy issues. [GH-1199] + - Vagrant works properly in folders with strange characters. [GH-1223] ## 1.0.6 (December 21, 2012) diff --git a/plugins/providers/virtualbox/action/default_name.rb b/plugins/providers/virtualbox/action/default_name.rb index 9ef89cf70..f1b0565dd 100644 --- a/plugins/providers/virtualbox/action/default_name.rb +++ b/plugins/providers/virtualbox/action/default_name.rb @@ -10,8 +10,12 @@ module VagrantPlugins end def call(env) - @logger.info("Setting the default name of the VM") - name = env[:root_path].basename.to_s + "_#{Time.now.to_i}" + # Figure out the name and sanitize the default + prefix = env[:root_path].basename.to_s + prefix.gsub!(/[^-a-z0-9_]/i, "") + name = prefix + "_#{Time.now.to_i}" + @logger.info("Setting the default name of the VM: #{name}") + env[:machine].provider.driver.set_name(name) @app.call(env)