From 16c194d2dce4a64b744dfb6c67ff12f6e98ec0c9 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 14 Jun 2021 22:34:47 +0200 Subject: [PATCH] core: fix upload api not checking clear properly Signed-off-by: Jens Langhammer --- authentik/core/api/applications.py | 2 +- authentik/flows/api/flows.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index 055b07214..706ee400c 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -202,7 +202,7 @@ class ApplicationViewSet(UsedByMixin, ModelViewSet): """Set application icon""" app: Application = self.get_object() icon = request.FILES.get("file", None) - clear = request.data.get("clear", False) + clear = request.data.get("clear", "false").lower() == "true" if clear: # .delete() saves the model by default app.meta_icon.delete() diff --git a/authentik/flows/api/flows.py b/authentik/flows/api/flows.py index 3ec01cc2f..21bedfcd6 100644 --- a/authentik/flows/api/flows.py +++ b/authentik/flows/api/flows.py @@ -301,7 +301,7 @@ class FlowViewSet(UsedByMixin, ModelViewSet): """Set Flow background""" flow: Flow = self.get_object() background = request.FILES.get("file", None) - clear = request.data.get("clear", False) + clear = request.data.get("clear", "false").lower() == "true" if clear: if flow.background_url.startswith("/media"): # .delete() saves the model by default