Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFTP connections not working without trailing slashes in folder paths #444

Open
pagan-gerbil opened this issue Jun 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@pagan-gerbil
Copy link

pagan-gerbil commented Jun 7, 2023

When trying to use the SFTP provider to get files, I ran into a possible bug - the SftpFileValue uses Path.Combine in the GetContent method to pass a filepath to the SFTP server, however if there's no trailing path delimiter ie, Path.Combine("SomeRoot/content", "filename.txt") then Path.Combine assumes the default for the machine it is running on. This can lead to a Linux SFTP server receiving a filepath with mixed forward and back slashes, and Renci.SshNet spits out a 'No such file' exception. That sent me down a lot of wrong turns since I assumed there was something wrong with the SFTP server or the authentication since the file clearly existed.

There is an easy workaround - make sure that there are trailing slashes in the path. It feels like Path.Combine is redundant in the SftpFileValue then because it's just concatenating the strings together at that point, and the error message as it stands is not helpful in trying to track down the issue (especially since the filepath isn't included in the exception, and the bits of path on their own seem sensible when passing them in - indeed, they work to get a list of the files at that location!)

@paillave paillave self-assigned this Jun 12, 2023
@paillave paillave added the bug Something isn't working label Jun 12, 2023
@paillave
Copy link
Owner

I will try to find a good solution for this, thanks for pointing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants