From 74b96901a1cc4919b81c2c2a5d11de00f43e9648 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 5 Jul 2021 14:10:08 -0500 Subject: guard cacheKey --- src/slskd/Integrations/Pushbullet/PushbulletService.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Integrations/Pushbullet/PushbulletService.cs b/src/slskd/Integrations/Pushbullet/PushbulletService.cs index a9b3121a..cb31e6dc 100644 --- a/src/slskd/Integrations/Pushbullet/PushbulletService.cs +++ b/src/slskd/Integrations/Pushbullet/PushbulletService.cs @@ -71,6 +71,11 @@ namespace slskd.Integrations.Pushbullet throw new ArgumentException("A notification title must be supplied", nameof(title)); } + if (string.IsNullOrWhiteSpace(cacheKey)) + { + throw new ArgumentException("A notification cache key must be supplied", nameof(cacheKey)); + } + if (string.IsNullOrWhiteSpace(body)) { throw new ArgumentException("A notification body must be supplied", nameof(body)); @@ -81,7 +86,7 @@ namespace slskd.Integrations.Pushbullet return Task.CompletedTask; } - RecentlySent.Set(cacheKey, value: 0, absoluteExpirationRelativeToNow: TimeSpan.FromMilliseconds(PushbulletOptions.CooldownTime)); + RecentlySent.Set(cacheKey, value: true, absoluteExpirationRelativeToNow: TimeSpan.FromMilliseconds(PushbulletOptions.CooldownTime)); return PushInternalAsync(title, body); } -- cgit v1.2.3