Fixed: Regression in folder move logic preventing updater from working.

This commit is contained in:
Taloth Saldono 2019-02-07 12:55:15 +01:00
parent f215ba9bac
commit cf327077e9
2 changed files with 19 additions and 1 deletions

View File

@ -813,6 +813,24 @@ namespace NzbDrone.Common.Test.DiskTests
.Verify(v => v.MoveFolder(src, dst), Times.Once()); .Verify(v => v.MoveFolder(src, dst), Times.Once());
} }
[Test]
public void TransferFolder_should_not_use_movefolder_if_on_same_mount_but_target_already_exists()
{
WithEmulatedDiskProvider();
var src = @"C:\Base1\TestDir1".AsOsAgnostic();
var dst = @"C:\Base1\TestDir2".AsOsAgnostic();
WithMockMount(@"C:\Base1".AsOsAgnostic());
WithExistingFile(@"C:\Base1\TestDir1\test.file.txt".AsOsAgnostic());
WithExistingFolder(dst);
Subject.TransferFolder(src, dst, TransferMode.Move);
Mocker.GetMock<IDiskProvider>()
.Verify(v => v.MoveFolder(src, dst), Times.Never());
}
[Test] [Test]
public void TransferFolder_should_not_use_movefolder_if_on_same_mount_but_transactional() public void TransferFolder_should_not_use_movefolder_if_on_same_mount_but_transactional()
{ {

View File

@ -56,7 +56,7 @@ namespace NzbDrone.Common.Disk
Ensure.That(sourcePath, () => sourcePath).IsValidPath(); Ensure.That(sourcePath, () => sourcePath).IsValidPath();
Ensure.That(targetPath, () => targetPath).IsValidPath(); Ensure.That(targetPath, () => targetPath).IsValidPath();
if (mode == TransferMode.Move) if (mode == TransferMode.Move && !_diskProvider.FolderExists(targetPath))
{ {
if (verificationMode == DiskTransferVerificationMode.TryTransactional || verificationMode == DiskTransferVerificationMode.VerifyOnly) if (verificationMode == DiskTransferVerificationMode.TryTransactional || verificationMode == DiskTransferVerificationMode.VerifyOnly)
{ {