mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-14 00:57:09 +00:00
* Fix #16211: Fix special charechter encoding in trino username * fix test and add comments
This commit is contained in:
parent
945cd35148
commit
a677910982
@ -49,7 +49,10 @@ def get_connection_url(connection: TrinoConnection) -> str:
|
|||||||
"""
|
"""
|
||||||
url = f"{connection.scheme.value}://"
|
url = f"{connection.scheme.value}://"
|
||||||
if connection.username:
|
if connection.username:
|
||||||
url += f"{quote_plus(connection.username)}"
|
# we need to encode twice because trino dialect internally
|
||||||
|
# url decodes the username and if there is an special char in username
|
||||||
|
# it will fail to authenticate
|
||||||
|
url += f"{quote_plus(quote_plus(connection.username))}"
|
||||||
if (
|
if (
|
||||||
isinstance(connection.authType, basicAuth.BasicAuth)
|
isinstance(connection.authType, basicAuth.BasicAuth)
|
||||||
and connection.authType.password
|
and connection.authType.password
|
||||||
|
|||||||
@ -407,7 +407,7 @@ class SourceConnectionTest(TestCase):
|
|||||||
assert expected_url == get_connection_url(trino_conn_obj)
|
assert expected_url == get_connection_url(trino_conn_obj)
|
||||||
|
|
||||||
# Passing @ in username and password
|
# Passing @ in username and password
|
||||||
expected_url = "trino://username%40444:pass%40111@localhost:443/catalog"
|
expected_url = "trino://username%2540444:pass%40111@localhost:443/catalog"
|
||||||
trino_conn_obj = TrinoConnection(
|
trino_conn_obj = TrinoConnection(
|
||||||
scheme=TrinoScheme.trino,
|
scheme=TrinoScheme.trino,
|
||||||
hostPort="localhost:443",
|
hostPort="localhost:443",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user