diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-07-05 14:10:08 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-07-05 14:10:08 -0500 |
| commit | 74b96901a1cc4919b81c2c2a5d11de00f43e9648 (patch) | |
| tree | 9d5aef764fa9495d7413063c05f90fdfe085b9f9 /src | |
| parent | a075536708d4e3d4a7656d8efc493b4dc294caa8 (diff) | |
| download | slskd-74b96901a1cc4919b81c2c2a5d11de00f43e9648.tar.gz | |
guard cacheKey
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Integrations/Pushbullet/PushbulletService.cs | 7 |
1 files changed, 6 insertions, 1 deletions
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); } |
