Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3938,7 +3938,7 @@ private void CopyFileInfoItem(FileInfo file, string destinationPath, bool force,
StringUtil.Format(FileSystemProviderStrings.CopyingLocalFileActivity, _copiedFiles, _totalFiles),
StringUtil.Format(FileSystemProviderStrings.CopyingLocalBytesStatus, Utils.DisplayHumanReadableFileSize(_copiedBytes), Utils.DisplayHumanReadableFileSize(_totalBytes), speed)
);
var percentComplete = (int)Math.Min(_copiedBytes * 100 / _totalBytes, 100);
var percentComplete = _totalBytes != 0 ? (int)Math.Min(_copiedBytes * 100 / _totalBytes, 100) : 100;
progress.PercentComplete = percentComplete;
progress.RecordType = ProgressRecordType.Processing;
WriteProgress(progress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" {
Remove-Item -Path $testPath -Recurse -Force -ErrorAction SilentlyContinue
}
}

It "Copy-Item can copy 0 byte length file" {
$zeroLengthFile = New-Item -Path (Join-Path $TestDrive "zeroLengthFile.txt") -ItemType File -Force
Copy-Item -Path $zeroLengthFile -Destination "$TestDrive\zeroLengthFile2.txt" -Force
"$TestDrive\zeroLengthFile2.txt" | Should -Exist
}
}

Context "Validate behavior when access is denied" {
Expand Down