From b184e62fa7dd7ecd089619f176e6388c1c3be25d 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 #4751 --- .../Clients/DownloadStation/TorrentDownloadStation.cs | 10 ++++++++-- .../Clients/DownloadStation/UsenetDownloadStation.cs | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs index 73d5e34ca..d416c1927 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs @@ -115,12 +115,18 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation { try { - var path = GetDownloadDirectory(); + var serialNumber = _serialNumberProvider.GetSerialNumber(Settings); + + // 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, new OsPath(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 ed8140260..51b01adbf 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -140,12 +140,18 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation { try { - var path = GetDownloadDirectory(); + var serialNumber = _serialNumberProvider.GetSerialNumber(Settings); + + // 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, new OsPath(path)) } + OutputRootFolders = new List { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, fullPath) } }; } catch (DownloadClientException e)