diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-07-08 15:17:24 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-07-08 15:17:24 -0500 |
| commit | 0b28c8fb0ce3ebe7d13bbcae5c4984475e1f7ab1 (patch) | |
| tree | 6b8abdcc1b86f08361ecae9539df80e4a936d6a8 /src/slskd/Transfers | |
| parent | e1ec9bd9e3eeb4e30765f06f19188c0493f8a040 (diff) | |
| download | slskd-0b28c8fb0ce3ebe7d13bbcae5c4984475e1f7ab1.tar.gz | |
use FileService when resolving files for uploads/relay
Diffstat (limited to 'src/slskd/Transfers')
| -rw-r--r-- | src/slskd/Transfers/Uploads/UploadService.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs index b5696988..36d239db 100644 --- a/src/slskd/Transfers/Uploads/UploadService.cs +++ b/src/slskd/Transfers/Uploads/UploadService.cs @@ -125,6 +125,7 @@ namespace slskd.Transfers.Uploads public class UploadService : IUploadService { public UploadService( + FileService fileService, IUserService userService, ISoulseekClient soulseekClient, IOptionsMonitor<Options> optionsMonitor, @@ -132,6 +133,7 @@ namespace slskd.Transfers.Uploads IRelayService relayService, IDbContextFactory<TransfersDbContext> contextFactory) { + Files = fileService; Users = userService; Client = soulseekClient; Shares = shareService; @@ -153,6 +155,7 @@ namespace slskd.Transfers.Uploads /// </summary> public IUploadQueue Queue { get; init; } + private FileService Files { get; } private ConcurrentDictionary<Guid, CancellationTokenSource> CancellationTokens { get; } = new ConcurrentDictionary<Guid, CancellationTokenSource>(); private ISoulseekClient Client { get; set; } private IDbContextFactory<TransfersDbContext> ContextFactory { get; } @@ -213,9 +216,9 @@ namespace slskd.Transfers.Uploads { // if it's local, do a quick check to see if it exists to spare the caller from queueing up if the transfer is // doomed to fail. for remote files, take a leap of faith. - var info = new FileInfo(localFilename).TryFollowSymlink(); + var info = Files.ResolveFileInfo(localFilename); - if (info?.Exists is null or false) + if (!info.Exists) { Shares.RequestScan(); throw new NotFoundException($"The file '{localFilename}' could not be located on disk. A share scan should be performed."); |
