Skip to content

Commit

Permalink
Fixed: Avoid logging evaluations when not using any Remote Path Mappings
Browse files Browse the repository at this point in the history
(cherry picked from commit 44eb729ccc13237f4439006159bd616e8bdb5750)
  • Loading branch information
mynameisbogdan committed Oct 10, 2023
1 parent 0a5f0ca commit aca8b82
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,16 @@ public OsPath RemapRemoteToLocal(string host, OsPath remotePath)
return remotePath;
}

var mappings = All();

if (mappings.Empty())
{
return remotePath;
}

_logger.Trace("Evaluating remote path remote mappings for match to host [{0}] and remote path [{1}]", host, remotePath.FullPath);
foreach (var mapping in All())

foreach (var mapping in mappings)
{
_logger.Trace("Checking configured remote path mapping: {0} - {1}", mapping.Host, mapping.RemotePath);
if (host.Equals(mapping.Host, StringComparison.InvariantCultureIgnoreCase) && new OsPath(mapping.RemotePath).Contains(remotePath))
Expand All @@ -150,8 +158,16 @@ public OsPath RemapLocalToRemote(string host, OsPath localPath)
return localPath;
}

var mappings = All();

if (mappings.Empty())
{
return localPath;
}

_logger.Trace("Evaluating remote path local mappings for match to host [{0}] and local path [{1}]", host, localPath.FullPath);
foreach (var mapping in All())

foreach (var mapping in mappings)
{
_logger.Trace("Checking configured remote path mapping {0} - {1}", mapping.Host, mapping.RemotePath);
if (host.Equals(mapping.Host, StringComparison.InvariantCultureIgnoreCase) && new OsPath(mapping.LocalPath).Contains(localPath))
Expand Down

0 comments on commit aca8b82

Please sign in to comment.