From 115940f252f5a3dc625441579c182017c802a6b7 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 15 Jan 2024 18:46:09 -0600 Subject: move resolve up --- src/slskd/Application.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 4c794179..46c21ff7 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -483,6 +483,18 @@ namespace slskd throw new DownloadEnqueueException("File not shared."); } + // in order to properly determine if the requested file would exceed any limits, we need to know the size of the file + (string Host, string Filename, long Size) resolved; + + try + { + resolved = await Shares.ResolveFileAsync(filename); + } + catch (NotFoundException) + { + throw new DownloadEnqueueException("File not shared."); + } + // get the user's group. this will be the name of the user's group, if they have been added to a // user defined group, or one of the built-ins; 'default', 'privileged', 'leecher', or 'blacklisted' var group = await Users.GetOrFetchGroupAsync(username); -- cgit v1.2.3