aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-09-23 18:58:29 -0500
committerJP Dillingham <jp@dillingham.me>2025-09-23 18:58:29 -0500
commit0b2e019e0d1fd5522afcf2e795427af822447482 (patch)
treede65420a238f33f24bd468bfec7318c0a673475f /src
parent29a158df5b94a2ffd2e4581e729a22d8793fbab3 (diff)
downloadslskd-0b2e019e0d1fd5522afcf2e795427af822447482.tar.gz
tweak duplicate check
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Transfers/Uploads/UploadService.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs
index 84152b59..5e0db336 100644
--- a/src/slskd/Transfers/Uploads/UploadService.cs
+++ b/src/slskd/Transfers/Uploads/UploadService.cs
@@ -518,11 +518,20 @@ namespace slskd.Transfers.Uploads
*/
if (existingInProgressRecords.Count != 0)
{
- Log.Information("Upload of {Filename} to {Username} is already queued or is in progress (ids: {Ids})", filename, username, string.Join(", ", existingInProgressRecords));
+ Log.Information("Upload of {Filename} to {Username} is already queued or is in progress (ids: {Ids})", filename, username, string.Join(", ", existingInProgressRecords.Select(t => t.Id)));
return null;
}
/*
+ check the tracked upload dictionary in Soulseek.NET to see if it knows about this already
+ it shouldn't, if the slskd database doesn't. but things could get desynced
+ */
+ if (Client.Uploads.Any(u => u.Username == username && u.Filename == filename))
+ {
+ throw new DuplicateTransferException("A duplicate upload of the same file to the same user is already registered");
+ }
+
+ /*
no existing transfers. next, check to see if they are requesting a file we are sharing
we do this after checking the database because database I/O is "cheaper" than disk and potentially