From b8e940ce1dbb67dc46987f1f3c192ef969f0f12c Mon Sep 17 00:00:00 2001 From: bruno Date: Fri, 17 Jan 2025 17:42:19 -0300 Subject: [PATCH] base fix for the connector, use urllib We would be able to parse the special url chars --- src/fides/api/service/connectors/mongodb_connector.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fides/api/service/connectors/mongodb_connector.py b/src/fides/api/service/connectors/mongodb_connector.py index 3389d2f01d..ad9d6ac5a8 100644 --- a/src/fides/api/service/connectors/mongodb_connector.py +++ b/src/fides/api/service/connectors/mongodb_connector.py @@ -3,6 +3,7 @@ from loguru import logger from pymongo import MongoClient from pymongo.errors import OperationFailure, ServerSelectionTimeoutError +import urllib from fides.api.common_exceptions import ConnectionException from fides.api.graph.execution import ExecutionNode @@ -34,13 +35,14 @@ def build_uri(self) -> str: user_pass: str = "" default_auth_db: str = "" if config.username and config.password: - user_pass = f"{config.username}:{config.password}@" + user_pass = urllib.parse.quote_plus( f"{config.username}:{config.password}@") if config.defaultauthdb: default_auth_db = f"/{config.defaultauthdb}" port: str = f":{config.port}" if config.port else "" url = f"mongodb://{user_pass}{config.host}{port}{default_auth_db}" + logger.info("Built URI: {}", url) return url def create_client(self) -> MongoClient: