core: fix url validator (#4957)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
5375637eda
commit
86f9056d3f
|
@ -43,14 +43,14 @@ class TestApplicationsAPI(APITestCase):
|
|||
self.assertEqual(
|
||||
self.client.patch(
|
||||
reverse("authentik_api:application-detail", kwargs={"slug": self.allowed.slug}),
|
||||
{"meta_launch_url": "https://%(username)s.test.goauthentik.io/%(username)s"},
|
||||
{"meta_launch_url": "https://%(username)s-test.test.goauthentik.io/%(username)s"},
|
||||
).status_code,
|
||||
200,
|
||||
)
|
||||
self.allowed.refresh_from_db()
|
||||
self.assertEqual(
|
||||
self.allowed.get_launch_url(self.user),
|
||||
f"https://{self.user.username}.test.goauthentik.io/{self.user.username}",
|
||||
f"https://{self.user.username}-test.test.goauthentik.io/{self.user.username}",
|
||||
)
|
||||
|
||||
def test_set_icon(self):
|
||||
|
|
|
@ -81,7 +81,8 @@ class DomainlessFormattedURLValidator(DomainlessURLValidator):
|
|||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self.host_re = r"([%\(\)a-zA-Z])+" + self.domain_re + self.domain_re
|
||||
self.formatter_re = r"([%\(\)a-zA-Z])*"
|
||||
self.host_re = "(" + self.formatter_re + self.hostname_re + self.domain_re + "|localhost)"
|
||||
self.regex = _lazy_re_compile(
|
||||
r"^(?:[a-z0-9.+-]*)://" # scheme is validated separately
|
||||
r"(?:[^\s:@/]+(?::[^\s:@/]*)?@)?" # user:pass authentication
|
||||
|
|
Reference in a new issue