Microsoft.PowerShell.Archive icon indicating copy to clipboard operation
Microsoft.PowerShell.Archive copied to clipboard

`compress-archive -update` deletes an existing zip file if the -path spec returns 0 files

Open kaiser-roy opened this issue 2 years ago • 1 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest version
  • [X] Search the existing issues.

Steps to reproduce

# make a tiny file
echo 'bibbity' > bibbity.txt

# this -path specification returns (at least) bibbity.txt and creates bobbity.zip
compress-archive -path bibbity.* -update -destinationpath bobbity.zip

# Now remove any such files
rm bibbity.*

# THIS path spec now returns nothing, and compress-archive actually deletes bobbity.zip!
compress-archive -path bibbity.* -update -destinationpath bobbity.zip

Expected behavior

The second call to compress-archive should leave the existing 'bobbity.zip' file undisturbed, but instead it completely removes it.

Actual behavior

'bobbity.zip' file is removed.

This is likely related to #112, though I think the use-case here is more general.

Error details

n/a

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

5.1.19041.1682

Visuals

No response

kaiser-roy avatar Oct 25 '22 21:10 kaiser-roy

Thanks for reporting the bug! Since this is related to #112, which may have been solved in the latest preview, this bug might also have been solved. I will need to double check though.

ayousuf23 avatar Oct 26 '22 01:10 ayousuf23