1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-24 08:42:19 +02:00

Fixed: Regression causing updater to fail and added measure to restore bad update

This commit is contained in:
Taloth Saldono 2020-10-11 19:26:33 +02:00
parent a7ca139e13
commit 8502f523e6
3 changed files with 30 additions and 3 deletions

View File

@ -661,6 +661,23 @@ public void MirrorFolder_should_not_touch_equivalent_files()
VerifyCopyFolder(original.FullName, destination.FullName);
}
[Test]
public void MirrorFolder_should_handle_trailing_slash()
{
WithRealDiskProvider();
var original = GetFilledTempFolder();
var source = new DirectoryInfo(GetTempFilePath());
var destination = new DirectoryInfo(GetTempFilePath());
Subject.TransferFolder(original.FullName, source.FullName, TransferMode.Copy);
var count = Subject.MirrorFolder(source.FullName + Path.DirectorySeparatorChar, destination.FullName);
count.Should().Equals(3);
VerifyCopyFolder(original.FullName, destination.FullName);
}
[Test]
public void TransferFolder_should_use_movefolder_if_on_same_mount()
{

View File

@ -29,13 +29,16 @@ public DiskTransferService(IDiskProvider diskProvider, Logger logger)
private string ResolveRealParentPath(string path)
{
var parentPath = path.GetParentPath();
if (!_diskProvider.FolderExists(path))
if (!_diskProvider.FolderExists(parentPath))
{
return path;
}
parentPath = parentPath.GetActualCasing();
return parentPath + Path.DirectorySeparatorChar + Path.GetFileName(path);
var realParentPath = parentPath.GetActualCasing();
var partialChildPath = path.Substring(parentPath.Length);
return realParentPath + partialChildPath;
}
public TransferMode TransferFolder(string sourcePath, string targetPath, TransferMode mode)

View File

@ -84,6 +84,13 @@ public void Start(string installationFolder, int processId)
Verify(installationFolder, processId);
if (installationFolder.EndsWith(@"\bin\Sonarr") || installationFolder.EndsWith(@"/bin/Sonarr"))
{
installationFolder = installationFolder.GetParentPath();
_logger.Info("Fixed Installation Folder: {0}", installationFolder);
}
var appType = _detectApplicationType.GetAppType();
_processProvider.FindProcessByName(ProcessProvider.SONARR_CONSOLE_PROCESS_NAME);