core: fix upload api not checking clear properly

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-14 22:34:47 +02:00
parent 53100a72fe
commit 16c194d2dc
2 changed files with 2 additions and 2 deletions

View File

@ -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()

View File

@ -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