Skip to content

Commit

Permalink
Modify for extra space outside of file path
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Dec 6, 2024
1 parent 21dd042 commit e51ca63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Snowflake.Data.Tests/UnitTests/SFFileTransferAgentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ internal static string getFilePathFromPutCommand(string query)
// E.g. "PUT file://C:<path-to-file> @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] == '\'')
Expand Down

0 comments on commit e51ca63

Please sign in to comment.