Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Created Unassigned: SftpSession does not handle "~" properly [1945]

$
0
0
When a path starts with "~", SftpSession.GetFullRemotePath does not handle it properly.

For instance,

```
SftpClient.Exists("~/somedir)
```

...does not do the check correctly.

I did a local fix by changing SftpSession.GetFullRemotePath to:

```
internal string GetFullRemotePath(string path)
{
var fullPath = path;

if (!string.IsNullOrEmpty(path) && path[0] == '~' && this.WorkingDirectory != null)
{
fullPath = path.Replace("~", this.WorkingDirectory);
}
else if (!string.IsNullOrEmpty(path) && path[0] != '/' && this.WorkingDirectory != null)
{
if (this.WorkingDirectory[this.WorkingDirectory.Length - 1] == '/')
{
fullPath = string.Format(CultureInfo.InvariantCulture, "{0}{1}", this.WorkingDirectory, path);
}
else
{
fullPath = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", this.WorkingDirectory, path);
}
}
return fullPath;
}

```

However I'm not 100% sure it is the correct fix, but it is a starting point to illustrate the issue.

Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>