Skip to content

SCP file download overwrites bytes in local file instead of replacing the entire file #648

@soul4soul

Description

@soul4soul

When I use SCP file download and overwrite a local file I expect the local file to be completely overwritten. What I'm finding is that the bytes are written to the existing file starting at offset 0. This can be reproduce by using SCP file download to retrieve a file which is smaller in size then the local file it will overwrite.

  1. Make a file on the local system with text "abcdef" call it a.txt
  2. Make a file on a remote system with text "def" call it a.txt
  3. Use SCP to download the remote file into the same directory as the local file
  4. View contents of local a.txt file
  5. I expect the contents to be def instead the contents of the file is def\nef

I initially reported this against Posh-SSH over at darkoperator/Posh-SSH#320. I was told it was a SSH.NET library issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions