From 7d0e7bcf7502357995e5f028f797d71cf9945cd3 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 8 Apr 2021 22:59:11 +0200 Subject: [PATCH] core: return none when application has no launch URL and none could be guessed Signed-off-by: Jens Langhammer --- authentik/core/api/applications.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index fff437bb5..b43904064 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -1,4 +1,6 @@ """Application API Views""" +from typing import Optional + from django.core.cache import cache from django.db.models import QuerySet from django.http.response import HttpResponseBadRequest @@ -35,9 +37,9 @@ class ApplicationSerializer(ModelSerializer): launch_url = SerializerMethodField() provider = ProviderSerializer(source="get_provider", required=False) - def get_launch_url(self, instance: Application) -> str: + def get_launch_url(self, instance: Application) -> Optional[str]: """Get generated launch URL""" - return instance.get_launch_url() or "" + return instance.get_launch_url() class Meta: