diff --git a/Snowflake.Data.Tests/UnitTests/SFFileTransferAgentTests.cs b/Snowflake.Data.Tests/UnitTests/SFFileTransferAgentTests.cs index cffd94f5b..e71dee38a 100644 --- a/Snowflake.Data.Tests/UnitTests/SFFileTransferAgentTests.cs +++ b/Snowflake.Data.Tests/UnitTests/SFFileTransferAgentTests.cs @@ -648,7 +648,7 @@ public void TestGetFilePathWithoutSpacesFromPutCommand() [Test] public void TestGetFilePathWithSpacesFromPutCommand() { - TestGetFilePathFromPutCommand("PUT file://" + s_filePathWithSpaces + " @TestStage", s_filePathWithSpaces); + TestGetFilePathFromPutCommand("PUT file://" + s_filePathWithSpaces + " @TestStage", s_filePathWithSpaces); } [Test] @@ -660,7 +660,7 @@ public void TestGetFilePathWithoutSpacesAndWithSingleQuotesFromPutCommand() [Test] public void TestGetFilePathWithSpacesAndWithSingleQuotesFromPutCommand() { - TestGetFilePathFromPutCommand("PUT 'file://" + s_filePathWithSpaces + "' @TestStage", s_filePathWithSpaces); + TestGetFilePathFromPutCommand("PUT 'file://" + s_filePathWithSpaces + "' @TestStage", s_filePathWithSpaces); } public void TestGetFilePathFromPutCommand(string query, string expectedFilePath) diff --git a/Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs b/Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs index c82bc740c..9936a3660 100644 --- a/Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs +++ b/Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs @@ -533,7 +533,7 @@ internal static string getFilePathFromPutCommand(string query) // E.g. "PUT file://C: @DB.SCHEMA.%TABLE;" int startIndex = query.IndexOf("file://") + "file://".Length; int endIndex = query.Substring(startIndex).IndexOf('@') - 1; - string filePath = query.Substring(startIndex, endIndex); + string filePath = query.Substring(startIndex, endIndex).Trim(); // Check if file path contains an enclosing (') char if (filePath[filePath.Length - 1] == '\'')