aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Relay/RelayClient.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-07-08 15:17:24 -0500
committerJP Dillingham <jp@dillingham.me>2024-07-08 15:17:24 -0500
commit0b28c8fb0ce3ebe7d13bbcae5c4984475e1f7ab1 (patch)
tree6b8abdcc1b86f08361ecae9539df80e4a936d6a8 /src/slskd/Relay/RelayClient.cs
parente1ec9bd9e3eeb4e30765f06f19188c0493f8a040 (diff)
downloadslskd-0b28c8fb0ce3ebe7d13bbcae5c4984475e1f7ab1.tar.gz
use FileService when resolving files for uploads/relay
Diffstat (limited to 'src/slskd/Relay/RelayClient.cs')
-rw-r--r--src/slskd/Relay/RelayClient.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs
index ea92407d..ae34e344 100644
--- a/src/slskd/Relay/RelayClient.cs
+++ b/src/slskd/Relay/RelayClient.cs
@@ -40,14 +40,17 @@ namespace slskd.Relay
/// Initializes a new instance of the <see cref="RelayClient"/> class.
/// </summary>
/// <param name="shareService"></param>
+ /// <param name="fileService"></param>
/// <param name="optionsMonitor"></param>
/// <param name="httpClientFactory"></param>
public RelayClient(
IShareService shareService,
+ FileService fileService,
IOptionsMonitor<Options> optionsMonitor,
IHttpClientFactory httpClientFactory)
{
Shares = shareService;
+ Files = fileService;
HttpClientFactory = httpClientFactory;
@@ -64,6 +67,7 @@ namespace slskd.Relay
/// </summary>
public IStateMonitor<RelayClientState> StateMonitor { get; }
+ private FileService Files { get; }
private SemaphoreSlim ConfigurationSyncRoot { get; } = new SemaphoreSlim(1, 1);
private bool Disposed { get; set; }
private IHttpClientFactory HttpClientFactory { get; }
@@ -361,7 +365,7 @@ namespace slskd.Relay
{
var (_, localFilename, _) = await Shares.ResolveFileAsync(filename);
- var localFileInfo = new FileInfo(localFilename).FollowSymlink();
+ var localFileInfo = Files.ResolveFileInfo(localFilename);
await HubConnection.InvokeAsync(nameof(RelayHub.ReturnFileInfo), id, localFileInfo.Exists, localFileInfo.Length);
}
@@ -382,7 +386,7 @@ namespace slskd.Relay
{
var (_, localFilename, _) = await Shares.ResolveFileAsync(filename);
- var localFileInfo = new FileInfo(localFilename);
+ var localFileInfo = Files.ResolveFileInfo(localFilename);
if (!localFileInfo.Exists)
{