Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
def transform_connection_string(connection_string) -> str:
auth_part, db_url_name = connection_string.rsplit("@", 1)
protocol_user, password_string = auth_part.rsplit(":", 1)
encoded_password = quote(password_string)
encoded_password = quote(password_string, safe="")
return f"{protocol_user}:{encoded_password}@{db_url_name}"
9 changes: 9 additions & 0 deletions src/backend/tests/unit/utils/test_connection_string_parser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urllib.parse import urlsplit

import pytest
from langflow.utils.connection_string_parser import transform_connection_string

Expand All @@ -18,3 +20,10 @@
def test_transform_connection_string(connection_string, expected):
result = transform_connection_string(connection_string)
assert result == expected


def test_transform_connection_string_encodes_slash_in_password():
result = transform_connection_string("postgresql://user:pa/ss@db.example:5432/app")

assert result == "postgresql://user:pa%2Fss@db.example:5432/app"
assert urlsplit(result).hostname == "db.example"
83 changes: 65 additions & 18 deletions src/lfx/src/lfx/_assets/component_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -12372,7 +12372,9 @@
"tool_mode": false
},
"CharacterTextSplitter": {
"base_classes": [],
"base_classes": [
"JSON"
],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
Expand Down Expand Up @@ -12416,8 +12418,11 @@
"group_outputs": false,
"method": "transform_data",
"name": "data",
"selected": "JSON",
"tool_mode": true,
"types": [],
"types": [
"JSON"
],
"value": "__UNDEFINED__"
}
],
Expand Down Expand Up @@ -13580,7 +13585,9 @@
"tool_mode": false
},
"LanguageRecursiveTextSplitter": {
"base_classes": [],
"base_classes": [
"JSON"
],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
Expand Down Expand Up @@ -13624,8 +13631,11 @@
"group_outputs": false,
"method": "transform_data",
"name": "data",
"selected": "JSON",
"tool_mode": true,
"types": [],
"types": [
"JSON"
],
"value": "__UNDEFINED__"
}
],
Expand Down Expand Up @@ -13778,7 +13788,9 @@
"tool_mode": false
},
"NaturalLanguageTextSplitter": {
"base_classes": [],
"base_classes": [
"JSON"
],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
Expand Down Expand Up @@ -13823,8 +13835,11 @@
"group_outputs": false,
"method": "transform_data",
"name": "data",
"selected": "JSON",
"tool_mode": true,
"types": [],
"types": [
"JSON"
],
"value": "__UNDEFINED__"
}
],
Expand Down Expand Up @@ -13975,7 +13990,10 @@
"tool_mode": false
},
"OpenAIToolsAgent": {
"base_classes": [],
"base_classes": [
"AgentExecutor",
"Message"
],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
Expand Down Expand Up @@ -14031,8 +14049,11 @@
"group_outputs": false,
"method": "message_response",
"name": "response",
"selected": "Message",
"tool_mode": true,
"types": [],
"types": [
"Message"
],
"value": "__UNDEFINED__"
},
{
Expand All @@ -14042,8 +14063,11 @@
"group_outputs": false,
"method": "build_agent",
"name": "agent",
"selected": "AgentExecutor",
"tool_mode": false,
"types": [],
"types": [
"AgentExecutor"
],
"value": "__UNDEFINED__"
}
],
Expand Down Expand Up @@ -14746,7 +14770,9 @@
"tool_mode": false
},
"RecursiveCharacterTextSplitter": {
"base_classes": [],
"base_classes": [
"JSON"
],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
Expand Down Expand Up @@ -14790,8 +14816,11 @@
"group_outputs": false,
"method": "transform_data",
"name": "data",
"selected": "JSON",
"tool_mode": true,
"types": [],
"types": [
"JSON"
],
"value": "__UNDEFINED__"
}
],
Expand Down Expand Up @@ -16478,7 +16507,10 @@
"tool_mode": false
},
"ToolCallingAgent": {
"base_classes": [],
"base_classes": [
"AgentExecutor",
"Message"
],
"beta": false,
"conditional_paths": [],
"custom_fields": {},
Expand Down Expand Up @@ -16533,8 +16565,11 @@
"group_outputs": false,
"method": "message_response",
"name": "response",
"selected": "Message",
"tool_mode": true,
"types": [],
"types": [
"Message"
],
"value": "__UNDEFINED__"
},
{
Expand All @@ -16544,8 +16579,11 @@
"group_outputs": false,
"method": "build_agent",
"name": "agent",
"selected": "AgentExecutor",
"tool_mode": false,
"types": [],
"types": [
"AgentExecutor"
],
"value": "__UNDEFINED__"
}
],
Expand Down Expand Up @@ -17242,7 +17280,10 @@
"tool_mode": false
},
"XMLAgent": {
"base_classes": [],
"base_classes": [
"AgentExecutor",
"Message"
],
"beta": true,
"conditional_paths": [],
"custom_fields": {},
Expand Down Expand Up @@ -17298,8 +17339,11 @@
"group_outputs": false,
"method": "message_response",
"name": "response",
"selected": "Message",
"tool_mode": true,
"types": [],
"types": [
"Message"
],
"value": "__UNDEFINED__"
},
{
Expand All @@ -17309,8 +17353,11 @@
"group_outputs": false,
"method": "build_agent",
"name": "agent",
"selected": "AgentExecutor",
"tool_mode": false,
"types": [],
"types": [
"AgentExecutor"
],
"value": "__UNDEFINED__"
}
],
Expand Down Expand Up @@ -30987,6 +31034,6 @@
"num_components": 127,
"num_modules": 16
},
"sha256": "7572f889a9012abfc0ecc2de7c45f5fcf7d5b85c24f7ec847afe5aa5f097754e",
"sha256": "b38dc88e6d01da028b3e0f4d2918c218e180e4c5b3d87d91cf00e18150bf8ee3",
"version": "1.12.0"
}
2 changes: 1 addition & 1 deletion src/lfx/src/lfx/utils/connection_string_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ def transform_connection_string(connection_string) -> str:
"""Transform connection string by encoding the password part."""
auth_part, db_url_name = connection_string.rsplit("@", 1)
protocol_user, password_string = auth_part.rsplit(":", 1)
encoded_password = quote(password_string)
encoded_password = quote(password_string, safe="")
return f"{protocol_user}:{encoded_password}@{db_url_name}"
10 changes: 10 additions & 0 deletions src/lfx/tests/unit/utils/test_connection_string_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from urllib.parse import urlsplit

from lfx.utils.connection_string_parser import transform_connection_string


def test_transform_connection_string_encodes_slash_in_password():
result = transform_connection_string("postgresql://user:pa/ss@db.example:5432/app")

assert result == "postgresql://user:pa%2Fss@db.example:5432/app"
assert urlsplit(result).hostname == "db.example"
Loading