From d24adda70084f0f807d2a98d204b16b509ae2397 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Mon, 9 Dec 2024 16:18:07 +0900 Subject: [PATCH] Fix throttling on PoS --- .../PointOfSale/Controllers/UIPointOfSaleController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs index 261e81e5a..c7678e9b8 100644 --- a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs +++ b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs @@ -430,9 +430,9 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers } private async Task Throttle(string appId) => - !(await _authorizationService.AuthorizeAsync(HttpContext.User, appId, Policies.CanViewInvoices)).Succeeded && - HttpContext.Connection?.RemoteIpAddress is not null && - !await _rateLimitService.Throttle(ZoneLimits.PublicInvoices, HttpContext.Connection.RemoteIpAddress.ToString(), HttpContext.RequestAborted); + HttpContext.Connection is { RemoteIpAddress: { } addr } && + await _rateLimitService.Throttle(ZoneLimits.PublicInvoices, addr.ToString(), HttpContext.RequestAborted) && + !(await _authorizationService.AuthorizeAsync(HttpContext.User, appId, Policies.CanViewInvoices)).Succeeded; private JObject TryParseJObject(string posData) {