Merge pull request #8995 from elatt/fix_synced_folders_spaces

Allow synced folders to contain spaces in the guest path
This commit is contained in:
Brian Cain 2017-09-29 15:19:39 -07:00 committed by GitHub
commit 87ee4f5662
2 changed files with 27 additions and 1 deletions

View File

@ -85,7 +85,7 @@ module VagrantPlugins
end end
def os_friendly_id(id) def os_friendly_id(id)
id.gsub(/[\/\\]/,'_').sub(/^_/, '') id.gsub(/[\s\/\\]/,'_').sub(/^_/, '')
end end
# share_folders sets up the shared folder definitions on the # share_folders sets up the shared folder definitions on the

View File

@ -44,4 +44,30 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do
it "should share the folders" it "should share the folders"
end end
describe "os_friendly_id" do
it "should not replace normal chars" do
expect(subject.send(:os_friendly_id, 'perfectly_valid0_name')).to eq('perfectly_valid0_name')
end
it "should replace spaces" do
expect(subject.send(:os_friendly_id, 'Program Files')).to eq('Program_Files')
end
it "should replace leading underscore" do
expect(subject.send(:os_friendly_id, '_vagrant')).to eq('vagrant')
end
it "should replace slash" do
expect(subject.send(:os_friendly_id, 'va/grant')).to eq('va_grant')
end
it "should replace leading underscore and slash" do
expect(subject.send(:os_friendly_id, '/vagrant')).to eq('vagrant')
end
it "should replace backslash" do
expect(subject.send(:os_friendly_id, 'foo\\bar')).to eq('foo_bar')
end
end
end end