aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-01-15 18:46:09 -0600
committerJP Dillingham <jp@dillingham.me>2024-01-15 18:46:09 -0600
commit115940f252f5a3dc625441579c182017c802a6b7 (patch)
tree7a61777b9043634743fc340abbcba510fb2d266c /src
parent9c76af6ec66ccc16c6e956203fbdfb8fc2a4a05f (diff)
downloadslskd-115940f252f5a3dc625441579c182017c802a6b7.tar.gz
move resolve up
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs12
1 files changed, 12 insertions, 0 deletions
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);