From 8b6c1fb969db7a77a240cbe056b591b0a178cf2d Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 27 Jul 2024 21:47:55 +0200 Subject: [PATCH] Fixed NPE on the `/auth` endpoint in case the user response is already a UserAuthStatus. --- platypush/backend/http/app/routes/auth.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/app/routes/auth.py b/platypush/backend/http/app/routes/auth.py index 7300feeea3..397805de43 100644 --- a/platypush/backend/http/app/routes/auth.py +++ b/platypush/backend/http/app/routes/auth.py @@ -233,7 +233,11 @@ def _auth_get(): status = response if status: - return UserAuthStatus.by_status(status).to_response() # type: ignore + if not isinstance(status, UserAuthStatus): + status = UserAuthStatus.by_status(status) + if not status: + status = UserAuthStatus.INVALID_CREDENTIALS + return status.to_response() return UserAuthStatus.INVALID_CREDENTIALS.to_response()