sshnet / sshnet/SSH.NET

Cannot upload to absolute path, "No such file"

Open
#1,081 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

In the C# code below, the goal is to upload the file C:\Temp\FlowCopy.7z to C:\Temp\Copy.7z on the same local machine. Instead, it results in “No such file”. Can an absolute path not be specified as a target?
If just the file name is specified as target, the file is copied to the C:\Users\agb46 folder.
Note that if the commented line containing the relative path to the same location is uncommented, the copy takes place and ends up in the C:\Temp folder.
using (SftpClient sftpclient = new SftpClient(new PasswordConnectionInfo("localhost", "agb46", "password")))
{
sftpclient.Connect();
string sourcefile = @"C:\Temp\FlowCopy.7z";
using (Stream stream = File.OpenRead(sourcefile))
{
//sftpclient.UploadFile(stream, @"....\Temp\Copy2.7z", x => { Console.WriteLine(x); });
sftpclient.UploadFile(stream, @"C:\Temp\Copy.7z", x => { Console.WriteLine(x); });
}
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the C# example using SftpClient.UploadFile with the absolute and relative targets shown in the issue. Trace how the upload target is handled and compare the resulting paths and errors. Done means the absolute Windows target behavior is corrected or clearly documented, with regression coverage added if the project identifies an existing test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.