From d454a094a02393954026b18ab421c87fa5ddbf9d Mon Sep 17 00:00:00 2001 From: Flaminel Date: Fri, 21 Feb 2025 15:41:48 +0200 Subject: [PATCH] fixed qbit file path --- .../Verticals/DownloadClient/QBittorrent/QBitService.cs | 9 +++++++-- .../Verticals/Files/HardlinkFileService.cs | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs index c48daa9..4642d2f 100644 --- a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs @@ -327,7 +327,12 @@ public class QBitService : DownloadService, IQBitService return; } - ulong hardlinkCount = _hardlinkFileService.GetHardLinkCount(file.Name); + string filePath = Path.Combine(Directory.Exists(download.ContentPath) + ? download.ContentPath + : download.SavePath, file.Name + ); + + ulong hardlinkCount = _hardlinkFileService.GetHardLinkCount(filePath); if (hardlinkCount is 0) { @@ -339,7 +344,7 @@ public class QBitService : DownloadService, IQBitService if (hardlinkCount > 1) { hasHardlinks = true; - }; + } } if (hasHardlinks) diff --git a/code/Infrastructure/Verticals/Files/HardlinkFileService.cs b/code/Infrastructure/Verticals/Files/HardlinkFileService.cs index c77e5c0..f349bf4 100644 --- a/code/Infrastructure/Verticals/Files/HardlinkFileService.cs +++ b/code/Infrastructure/Verticals/Files/HardlinkFileService.cs @@ -15,6 +15,12 @@ public class HardlinkFileService : IHardlinkFileService public ulong GetHardLinkCount(string filePath) { + if (!File.Exists(filePath)) + { + _logger.LogDebug("file {file} does not exist", filePath); + return default; + } + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return GetWindowsHardLinkCount(filePath);