From 9370d155f858ab5d561e0cf33dbca5de8a25e662 Mon Sep 17 00:00:00 2001 From: Jens L Date: Thu, 2 Mar 2023 23:21:54 +0100 Subject: [PATCH] sources/plex: fix check_token error unusable if token is empty (#4834) Signed-off-by: Jens Langhammer --- authentik/sources/plex/tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/authentik/sources/plex/tasks.py b/authentik/sources/plex/tasks.py index 59fc4594e..62229d88f 100644 --- a/authentik/sources/plex/tasks.py +++ b/authentik/sources/plex/tasks.py @@ -29,7 +29,9 @@ def check_plex_token(self: MonitoredTask, source_slug: int): auth.get_user_info() self.set_status(TaskResult(TaskResultStatus.SUCCESSFUL, ["Plex token is valid."])) except RequestException as exc: - error = exception_to_string(exc).replace(source.plex_token, "$PLEX_TOKEN") + error = exception_to_string(exc) + if source.plex_token != "": + error = error.replace(source.plex_token, "$PLEX_TOKEN") self.set_status( TaskResult( TaskResultStatus.ERROR,