From 693a070a40cbfc9f6c0ba2afbc12d8e9fb745187 Mon Sep 17 00:00:00 2001 From: Sielnix Date: Tue, 9 Jan 2024 19:40:16 +0100 Subject: [PATCH] Fix lowercase db or schema in connection string --- Snowflake.Data/Core/Session/SFSession.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Snowflake.Data/Core/Session/SFSession.cs b/Snowflake.Data/Core/Session/SFSession.cs index cb9e4f0fe..ec70f99a7 100755 --- a/Snowflake.Data/Core/Session/SFSession.cs +++ b/Snowflake.Data/Core/Session/SFSession.cs @@ -119,8 +119,8 @@ internal Uri BuildLoginUrl() string schemaValue; string roleName; queryParams[RestParams.SF_QUERY_WAREHOUSE] = properties.TryGetValue(SFSessionProperty.WAREHOUSE, out warehouseValue) ? warehouseValue : ""; - queryParams[RestParams.SF_QUERY_DB] = properties.TryGetValue(SFSessionProperty.DB, out dbValue) ? dbValue : ""; - queryParams[RestParams.SF_QUERY_SCHEMA] = properties.TryGetValue(SFSessionProperty.SCHEMA, out schemaValue) ? schemaValue : ""; + queryParams[RestParams.SF_QUERY_DB] = EscapeDbObjectForUrl(properties.TryGetValue(SFSessionProperty.DB, out dbValue) ? dbValue : ""); + queryParams[RestParams.SF_QUERY_SCHEMA] = EscapeDbObjectForUrl(properties.TryGetValue(SFSessionProperty.SCHEMA, out schemaValue) ? schemaValue : ""); queryParams[RestParams.SF_QUERY_ROLE] = properties.TryGetValue(SFSessionProperty.ROLE, out roleName) ? roleName : ""; queryParams[RestParams.SF_QUERY_REQUEST_ID] = Guid.NewGuid().ToString(); queryParams[RestParams.SF_QUERY_REQUEST_GUID] = Guid.NewGuid().ToString(); @@ -129,6 +129,11 @@ internal Uri BuildLoginUrl() return loginUrl; } + private string EscapeDbObjectForUrl(string name) + { + return name == string.Empty ? name : $"\"{name.Replace("\"", "\"\"")}\""; + } + /// /// Constructor ///