From 82f66685b57473b3bedfe2c679dac3f4f88bfb70 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 15 Jun 2019 09:46:47 -0700 Subject: [PATCH] Fixed: Remote path mapping host comparison ignores case Closes #3169 --- .../RemotePathMappingServiceFixture.cs | 2 ++ .../RemotePathMappings/RemotePathMappingService.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/RemotePathMappingsTests/RemotePathMappingServiceFixture.cs b/src/NzbDrone.Core.Test/RemotePathMappingsTests/RemotePathMappingServiceFixture.cs index b041e1dfe..15bda4fd9 100644 --- a/src/NzbDrone.Core.Test/RemotePathMappingsTests/RemotePathMappingServiceFixture.cs +++ b/src/NzbDrone.Core.Test/RemotePathMappingsTests/RemotePathMappingServiceFixture.cs @@ -87,6 +87,7 @@ namespace NzbDrone.Core.Test.RemotePathMappingsTests } [TestCase("my-server.localdomain", "/mnt/storage/downloads/tv", @"D:\mountedstorage\downloads\tv")] + [TestCase("My-Server.localdomain", "/mnt/storage/downloads/tv", @"D:\mountedstorage\downloads\tv")] [TestCase("my-2server.localdomain", "/mnt/storage/downloads/tv", "/mnt/storage/downloads/tv")] [TestCase("my-server.localdomain", "/mnt/storageabc/downloads/tv", "/mnt/storageabc/downloads/tv")] public void should_remap_remote_to_local(string host, string remotePath, string expectedLocalPath) @@ -101,6 +102,7 @@ namespace NzbDrone.Core.Test.RemotePathMappingsTests } [TestCase("my-server.localdomain", "/mnt/storage/downloads/tv", @"D:\mountedstorage\downloads\tv")] + [TestCase("My-Server.localdomain", "/mnt/storage/downloads/tv", @"D:\mountedstorage\downloads\tv")] [TestCase("my-server.localdomain", "/mnt/storage/", @"D:\mountedstorage")] [TestCase("my-2server.localdomain", "/mnt/storage/downloads/tv", "/mnt/storage/downloads/tv")] [TestCase("my-server.localdomain", "/mnt/storageabc/downloads/tv", "/mnt/storageabc/downloads/tv")] diff --git a/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs b/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs index d0d2e05be..5e7b0d889 100644 --- a/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs +++ b/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs @@ -129,7 +129,7 @@ namespace NzbDrone.Core.RemotePathMappings foreach (var mapping in All()) { - if (host == mapping.Host && new OsPath(mapping.RemotePath).Contains(remotePath)) + if (host.Equals(mapping.Host, StringComparison.InvariantCultureIgnoreCase) && new OsPath(mapping.RemotePath).Contains(remotePath)) { var localPath = new OsPath(mapping.LocalPath) + (remotePath - new OsPath(mapping.RemotePath)); @@ -149,7 +149,7 @@ namespace NzbDrone.Core.RemotePathMappings foreach (var mapping in All()) { - if (host == mapping.Host && new OsPath(mapping.LocalPath).Contains(localPath)) + if (host.Equals(mapping.Host, StringComparison.InvariantCultureIgnoreCase) && new OsPath(mapping.LocalPath).Contains(localPath)) { var remotePath = new OsPath(mapping.RemotePath) + (localPath - new OsPath(mapping.LocalPath));