aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Transfers/Downloads/DownloadService.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs
index beeab755..17ebf089 100644
--- a/src/slskd/Transfers/Downloads/DownloadService.cs
+++ b/src/slskd/Transfers/Downloads/DownloadService.cs
@@ -246,13 +246,18 @@ namespace slskd.Transfers.Downloads
throw new ArgumentException("Username is required", nameof(username));
}
- var fileList = files.ToList();
+ var fileList = files?.ToList() ?? [];
if (fileList.Count == 0)
{
throw new ArgumentException("At least one file is required", nameof(files));
}
+ if (fileList.Any(f => string.IsNullOrWhiteSpace(f.Filename)))
+ {
+ throw new ArgumentException("At least one filename is null, empty, or consists of only whitespace", nameof(files));
+ }
+
if (fileList.Count != fileList.Distinct().Count())
{
throw new ArgumentException("Two or more files in request are duplicated", nameof(files));