From 277df4f04f99f727c8ae8d8c5d38e87c202ce4f6 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 27 Jul 2022 09:48:11 +0200 Subject: [PATCH] stages/prompt: fix tests for file field Signed-off-by: Jens Langhammer --- authentik/stages/prompt/models.py | 4 ++-- authentik/stages/prompt/tests.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/authentik/stages/prompt/models.py b/authentik/stages/prompt/models.py index eb70b97c0..36872f866 100644 --- a/authentik/stages/prompt/models.py +++ b/authentik/stages/prompt/models.py @@ -1,6 +1,6 @@ """prompt models""" from typing import Any, Optional -from urllib.parse import urlparse +from urllib.parse import urlparse, urlunparse from uuid import uuid4 from django.db import models @@ -89,7 +89,7 @@ class InlineFileField(CharField): _mime, _, enc = header.partition(";") if enc != "base64": raise ValidationError("Invalid encoding") - return super().to_internal_value(uri) + return super().to_internal_value(urlunparse(uri)) class Prompt(SerializerModel): diff --git a/authentik/stages/prompt/tests.py b/authentik/stages/prompt/tests.py index 5258b8975..414d19751 100644 --- a/authentik/stages/prompt/tests.py +++ b/authentik/stages/prompt/tests.py @@ -118,11 +118,11 @@ class TestPromptStage(FlowTestCase): InlineFileField().to_internal_value("data:foo/bar;foo,qwer") self.assertEqual( InlineFileField().to_internal_value("data:mine/type;base64,Zm9v"), - "foo", + "data:mine/type;base64,Zm9v", ) self.assertEqual( InlineFileField().to_internal_value("data:mine/type;base64,Zm9vqwer"), - "Zm9vqwer", + "data:mine/type;base64,Zm9vqwer", ) def test_render(self):