mirror of
https://github.com/Radarr/Radarr
synced 2026-05-07 14:01:25 +02:00
Merge e7e3a1c2ee into 9226876792
This commit is contained in:
commit
ab391038f4
2 changed files with 19 additions and 4 deletions
|
|
@ -540,6 +540,21 @@ public void MoveFolder_should_rename_caseinsensitive_folder()
|
|||
source.FullName.GetActualCasing().Should().Be(destination.FullName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TransferFile_should_find_files_with_multiple_slashes_within_their_path()
|
||||
{
|
||||
WithRealDiskProvider();
|
||||
|
||||
var root = GetFilledTempFolder();
|
||||
var rootDir = root.FullName;
|
||||
var from = Path.Combine(rootDir, "source-file");
|
||||
var toRootDir = rootDir.Replace(Path.DirectorySeparatorChar.ToString(), new string(Path.DirectorySeparatorChar, 3));
|
||||
var to = Path.Combine(toRootDir, "destination-file");
|
||||
File.WriteAllText(from, "Source file");
|
||||
var mode = Subject.TransferFile(from, to, TransferMode.Copy);
|
||||
mode.Should().Be(TransferMode.Copy);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_if_destination_is_readonly()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ public DiskTransferService(IDiskProvider diskProvider, Logger logger)
|
|||
|
||||
private string ResolveRealParentPath(string path)
|
||||
{
|
||||
var parentPath = path.GetParentPath();
|
||||
if (!_diskProvider.FolderExists(parentPath))
|
||||
if (!_diskProvider.FolderExists(path.GetParentPath()))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
var cleanPath = path.GetCleanPath();
|
||||
var parentPath = cleanPath.GetParentPath();
|
||||
var realParentPath = parentPath.GetActualCasing();
|
||||
|
||||
var partialChildPath = path.Substring(parentPath.Length);
|
||||
var partialChildPath = cleanPath.Substring(parentPath.Length);
|
||||
|
||||
return realParentPath + partialChildPath;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue