From 8352223704e2eafbe0e9bee65281b507bfe2ec7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 11 Dec 2023 11:57:36 +0100 Subject: [PATCH] fix: lnurl should follow redirect (#2167) `r.raise_for_status` raises an proper exception now --- lnbits/core/views/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 1ab1f361..8382b7c3 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -405,7 +405,7 @@ async def api_payments_pay_lnurl( domain = urlparse(data.callback).netloc headers = {"User-Agent": settings.user_agent} - async with httpx.AsyncClient(headers=headers) as client: + async with httpx.AsyncClient(headers=headers, follow_redirects=True) as client: try: r = await client.get( data.callback, @@ -414,6 +414,7 @@ async def api_payments_pay_lnurl( ) if r.is_error: raise httpx.ConnectError("LNURL callback connection error") + r.raise_for_status() except (httpx.ConnectError, httpx.RequestError): raise HTTPException( status_code=HTTPStatus.BAD_REQUEST,