fix(proxy_extras): preserve host parameter in _strip_prisma_query_params

This commit is contained in:
Ansh Rohilla 2026-09-28 22:54:25 +05:30
parent 6f5ad78a1f
commit 4d4f97986f
2 changed files with 11 additions and 0 deletions

View file

@ -656,6 +656,9 @@ class ProxyExtrasDBManager:
if not parsed.query:
return url
libpq_params = {
"host",
"hostaddr",
"port",
"sslmode",
"sslcert",
"sslkey",

View file

@ -71,6 +71,14 @@ def test_strip_prisma_query_params_passthrough_no_query():
assert ProxyExtrasDBManager._strip_prisma_query_params(url) == url
def test_strip_prisma_query_params_preserves_host_socket():
"""Unix-socket DATABASE_URLs using host parameter (e.g. Cloud SQL) must be preserved."""
url = "postgresql://user:pass@localhost/litellm?host=/cloudsql/project:region:instance&connection_limit=10"
stripped = ProxyExtrasDBManager._strip_prisma_query_params(url)
assert "host=%2Fcloudsql%2Fproject%3Aregion%3Ainstance" in stripped
assert "connection_limit" not in stripped
def test_migration_timestamp_extracts_leading_digits():
assert _migration_timestamp("20260101000000_add_foo") == 20260101000000
assert _migration_timestamp("20250326162113_baseline") == 20250326162113