From 34b269086da59c4eb70f3415a34ffe5550273dfc Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 21 Nov 2021 11:39:22 -0800 Subject: [PATCH] Fixed: Get full path for download station instead of shared folder Closes #6751 Fixes #6818 (cherry picked from commit b184e62fa7dd7ecd089619f176e6388c1c3be25d) --- .../Clients/DownloadStation/TorrentDownloadStation.cs | 11 +++++++---- .../Clients/DownloadStation/UsenetDownloadStation.cs | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs index 79af766137..f742caf302 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs @@ -118,14 +118,17 @@ public override DownloadClientInfo GetStatus() try { var serialNumber = _serialNumberProvider.GetSerialNumber(Settings); - var sharedFolder = GetDownloadDirectory() ?? GetDefaultDir(); - var outputPath = new OsPath($"/{sharedFolder.TrimStart('/')}"); - var path = _sharedFolderResolver.RemapToFullPath(outputPath, Settings, serialNumber); + + // Download station returns the path without the leading `/`, but the leading + // slash is required to get the full path back from download station. + var path = new OsPath($"/{GetDownloadDirectory()}"); + + var fullPath = _sharedFolderResolver.RemapToFullPath(path, Settings, serialNumber); return new DownloadClientInfo { IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "localhost", - OutputRootFolders = new List { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, path) } + OutputRootFolders = new List { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, fullPath) } }; } catch (DownloadClientException e) diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs index d708281e09..f63f7d6cae 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -142,14 +142,17 @@ public override DownloadClientInfo GetStatus() try { var serialNumber = _serialNumberProvider.GetSerialNumber(Settings); - var sharedFolder = GetDownloadDirectory() ?? GetDefaultDir(); - var outputPath = new OsPath($"/{sharedFolder.TrimStart('/')}"); - var path = _sharedFolderResolver.RemapToFullPath(outputPath, Settings, serialNumber); + + // Download station returns the path without the leading `/`, but the leading + // slash is required to get the full path back from download station. + var path = new OsPath($"/{GetDownloadDirectory()}"); + + var fullPath = _sharedFolderResolver.RemapToFullPath(path, Settings, serialNumber); return new DownloadClientInfo { IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "localhost", - OutputRootFolders = new List { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, path) } + OutputRootFolders = new List { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, fullPath) } }; } catch (DownloadClientException e)