Cannot upload to absolute path, "No such file"
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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