darkoperator / darkoperator/Posh-SSH

Get-SCPFile not clearing old file on overwrite

Open
#392 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

When overwriting a local file, and the downloaded file is shorter, Get-SCPFile does not remove the old file first.

As a result, the new file file contains the end of the old file.
Eg if the old file is "abcdefghijk" and you download "www", you end up with "wwwdefghijk"

The command I was using was: Get-SCPFile -ComputerName $sddcMgr -Credential $cred -LocalFile '.\Cache\markerfile' -RemoteFile '/home/vcf/markerFile' -force

This was on the SDDC manager markerFile on VCF 4.2.

Contributor guide

No contributing guide indexed for this repository

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 at the Get-SCPFile command entry point and reproduce the overwrite case described with a shorter remote file and an existing local file. Done means the local file contains only the downloaded content, without trailing bytes from the previous file; the payload does not name a specific implementation file or test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.