From 8b8f72129ce58dbeca5d812c095f9a7d7a05e7f0 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Tue, 2 May 2023 13:15:16 +0200 Subject: [PATCH] Crowdfund: Fix redirect URL fallback As the request for invoice creation is issued via web socket, the display URL ends up being the hob connection URL. This replaces it with the actual app URL and fixes #4930. --- .../Crowdfund/Controllers/UICrowdfundController.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs b/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs index 420c0883b..e6388e2a9 100644 --- a/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs +++ b/BTCPayServer/Plugins/Crowdfund/Controllers/UICrowdfundController.cs @@ -174,6 +174,8 @@ namespace BTCPayServer.Plugins.Crowdfund.Controllers try { + var appPath = await _appService.ViewLink(app); + var appUrl = HttpContext.Request.GetAbsoluteUri(appPath); var invoice = await _invoiceController.CreateInvoiceCore(new BitpayCreateInvoiceRequest() { OrderId = AppService.GetAppOrderId(app), @@ -186,12 +188,12 @@ namespace BTCPayServer.Plugins.Crowdfund.Controllers FullNotifications = true, ExtendedNotifications = true, SupportedTransactionCurrencies = paymentMethods, - RedirectURL = request.RedirectUrl ?? Request.GetDisplayUrl(), + RedirectURL = request.RedirectUrl ?? appUrl, }, store, HttpContext.Request.GetAbsoluteRoot(), - new List() { AppService.GetAppInternalTag(appId) }, - cancellationToken, (entity) => + new List { AppService.GetAppInternalTag(appId) }, + cancellationToken, entity => { - entity.Metadata.OrderUrl = Request.GetDisplayUrl(); + entity.Metadata.OrderUrl = appUrl; }); if (request.RedirectToCheckout)