Skip to content

Commit 4e9468f

Browse files
authored
Fixed an issue where extracting files from a zip archive would result in corrupted files (#6099)
1 parent 67e2bc2 commit 4e9468f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Files/Helpers/ZipHelpers.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public static async Task ExtractArchive(BaseStorageFile archive, BaseStorageFold
4747
catch (InvalidNameException ex)
4848
{
4949
App.Logger.Warn(ex, $"Error transforming zip names into: {destinationFolder.Path}\n" +
50-
$"Directories: {directoryEntries.Select(x => x.Name)}\n" +
51-
$"Files: {fileEntries.Select(x => x.Name)}");
50+
$"Directories: {string.Join(", ", directoryEntries.Select(x => x.Name))}\n" +
51+
$"Files: {string.Join(", ", fileEntries.Select(x => x.Name))}");
5252
return;
5353
}
5454

@@ -110,7 +110,7 @@ public static async Task ExtractArchive(BaseStorageFile archive, BaseStorageFold
110110
{
111111
while ((currentBlockSize = await entryStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
112112
{
113-
await destinationStream.WriteAsync(buffer, 0, buffer.Length);
113+
await destinationStream.WriteAsync(buffer, 0, currentBlockSize);
114114

115115
if (cancellationToken.IsCancellationRequested) // Check if cancelled
116116
{

0 commit comments

Comments
 (0)