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 ///