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

ScpClient: Upload of file should fail if remote path exists as directory #286

Closed
drieseng opened this issue Aug 26, 2017 · 0 comments
Closed
Assignees

Comments

@drieseng
Copy link
Member

drieseng commented Aug 26, 2017

The current behavior of the Upload(FileInfo fileInfo, string path) method is not deterministic. The path to which the content is uploaded depends on whether a directory exists for the specified (remote) path.

Path does not exist as directory

When no directory exists for the (remote) path that is specified in Upload(FileInfo fileInfo, string path), then the file is - as expected - uploaded to the path in question.

Example

Local path: c:\source\somefile.txt
Remote path: /home/sshnet/file
Result: content of c:\source\somefile.txt is uploaded to /home/sshnet/file.

Path exists as directory

However, if a directory exists for the specified path then the content is uploaded to '<(remote) path>/<fileInfo.Name>'.

Example

Local path: c:\source\somefile.txt
Remote path: /home/sshnet/file
Result: Content of c:\source\somefile.txt is uploaded to /home/sshnet/file/somefile.txt.

Proposal

Instead of having this non-deterministic behavior, we should have the SCP server reject the upload if a directory exists for the specified (remote) file path.

@drieseng drieseng self-assigned this Aug 26, 2017
@drieseng drieseng added this to the 2016.1.0-beta3 milestone Aug 26, 2017
drieseng added a commit that referenced this issue Aug 27, 2017
…ng a file, and use zero-length pass in C directive. Combined, this ensure the SCP server will reject a remote file path that points to a directory.

Fixes issue #286.
drieseng added a commit that referenced this issue Aug 27, 2017
…ng a file, and use zero-length pass in C directive. Combined, this ensure the SCP server will reject a remote file path that points to a directory.

Fixes issue #286.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant