diff --git a/plugins/providers/hyperv/sync_helper.rb b/plugins/providers/hyperv/sync_helper.rb index 601ef44a4..003a625c7 100644 --- a/plugins/providers/hyperv/sync_helper.rb +++ b/plugins/providers/hyperv/sync_helper.rb @@ -265,7 +265,8 @@ module VagrantPlugins source_copy = platform_join windows_temp, filename, is_windows: !Vagrant::Util::Platform.wsl? FileUtils.mv source, source_copy source = source_copy - hyperv_copy machine, source, dest_dir + win_source_path = Vagrant::Util::Platform.windows_path(source, :disable_unc) + hyperv_copy machine, win_source_path, dest_dir else machine.communicate.upload(source, dest) end diff --git a/test/unit/plugins/providers/hyperv/sync_helper_test.rb b/test/unit/plugins/providers/hyperv/sync_helper_test.rb index 02b4e46dd..bc3b83fb1 100644 --- a/test/unit/plugins/providers/hyperv/sync_helper_test.rb +++ b/test/unit/plugins/providers/hyperv/sync_helper_test.rb @@ -701,6 +701,7 @@ describe VagrantPlugins::HyperV::SyncHelper do let(:is_windows) { host_type == :Windows } let(:source) { sources[host_type] } let(:new_source) { new_sources[host_type] } + let(:new_source_windows) { new_sources[:Windows] } context "uploads file by Hyper-V daemons when applicable" do let(:windows_temp) { windows_temps[host_type] } @@ -709,6 +710,8 @@ describe VagrantPlugins::HyperV::SyncHelper do allow(subject).to receive(:hyperv_copy?).with(machine).and_return(true) allow(subject).to receive(:format_windows_temp).and_return(windows_temp) allow(Vagrant::Util::Platform).to receive(:wsl?).and_return(!is_windows) + allow(Vagrant::Util::Platform).to receive(:windows_path). + with(new_source, :disable_unc).and_return(new_source_windows) allow(FileUtils).to receive(:rm_f) allow(FileUtils).to receive(:mv) allow(subject).to receive(:hyperv_copy) @@ -724,7 +727,7 @@ describe VagrantPlugins::HyperV::SyncHelper do end it "calls Hyper-V cmdlet to copy file" do - expect(subject).to receive(:hyperv_copy).with(machine, new_source, dest_dir) + expect(subject).to receive(:hyperv_copy).with(machine, new_source_windows, dest_dir) end end