Skip to content

Commit a882c4f

Browse files
niheavenr15ch13
authored andcommitted
fix(decompress): '$ExtractDir' removed original extract file by accident (#3470)
1 parent 2fafcb8 commit a882c4f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/decompress.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function Expand-MsiArchive {
141141
movedir "$DestinationPath\SourceDir\$ExtractDir" $DestinationPath | Out-Null
142142
Remove-Item "$DestinationPath\SourceDir" -Recurse -Force
143143
} elseif ($ExtractDir) {
144-
Get-ChildItem $DestinationPath -Exclude $ExtractDir | Remove-Item -Recurse -Force
144+
Get-ChildItem $DestinationPath -Exclude $ExtractDir, $Path | Remove-Item -Recurse -Force
145145
movedir "$DestinationPath\$ExtractDir" $DestinationPath | Out-Null
146146
} elseif (Test-Path "$DestinationPath\SourceDir") {
147147
movedir "$DestinationPath\SourceDir" $DestinationPath | Out-Null
@@ -236,7 +236,7 @@ function Expand-ZipArchive {
236236
Microsoft.PowerShell.Archive\Expand-Archive -Path $Path -DestinationPath $DestinationPath -Force
237237
}
238238
if ($ExtractDir) {
239-
Get-ChildItem $DestinationPath -Exclude $ExtractDir | Remove-Item -Recurse -Force
239+
Get-ChildItem $DestinationPath -Exclude $ExtractDir, $Path | Remove-Item -Recurse -Force
240240
movedir "$DestinationPath\$ExtractDir" $DestinationPath | Out-Null
241241
}
242242
if ($Removal) {
@@ -276,7 +276,7 @@ function Expand-DarkArchive {
276276
Remove-Item $LogPath -Force
277277
}
278278
if ($ExtractDir) {
279-
Get-ChildItem $DestinationPath -Exclude $ExtractDir | Remove-Item -Recurse -Force
279+
Get-ChildItem $DestinationPath -Exclude $ExtractDir, $Path | Remove-Item -Recurse -Force
280280
movedir "$DestinationPath\$ExtractDir" $DestinationPath | Out-Null
281281
}
282282
if ($Removal) {

0 commit comments

Comments
 (0)