Unplanned
Last Updated: 15 Mar 2024 15:42 by XicoFininho
The attached gif file illustrates the inability to open the newly added file with the password: 
    Sub Main()
        Dim sZipFilePath As String = "..\..\test.zip"
        File.Delete(sZipFilePath)

        CreateArchive(sZipFilePath)
        Dim decryptionSettings As DecryptionSettings = EncryptionSettings.CreateDecryptionSettings()
        AddHandler decryptionSettings.PasswordRequired, AddressOf DecryptionSettings_PasswordRequired
        Dim compressionSettings As CompressionSettings = Nothing
        Dim encoding As Encoding = Nothing
        Using oFS As FileStream = File.Open(sZipFilePath, FileMode.OpenOrCreate)


            Using oArchive As ZipArchive = ZipArchive.Update(oFS, encoding, compressionSettings, decryptionSettings)
                Using entry As ZipArchiveEntry = oArchive.CreateEntry("newText.txt")
                    Dim writer As StreamWriter = New StreamWriter(entry.Open())
                    writer.WriteLine("Hello world!")
                    writer.Flush()
                End Using
            End Using
        End Using
    End Sub

    Private Sub CreateArchive(sZipFilePath As String)
        Using stream As Stream = File.Open(sZipFilePath, FileMode.Create)
            Dim _encryptionSettings As PasswordEncryptionSettings = EncryptionSettings.CreatePkzipPasswordEncryptionSettings()
            _encryptionSettings.Password = "telerik"
            Dim compressionSettings As CompressionSettings = Nothing
            Dim encoding As Encoding = Nothing

            Using archive As ZipArchive = ZipArchive.Create(stream, encoding, compressionSettings, _encryptionSettings)

                Using entry As ZipArchiveEntry = archive.CreateEntry("text.txt")
                    Dim writer As StreamWriter = New StreamWriter(entry.Open())
                    writer.WriteLine("Hello world!")
                    writer.Flush()
                End Using
            End Using
        End Using
    End Sub

    Private Sub DecryptionSettings_PasswordRequired(ByVal sender As Object, ByVal e As PasswordRequiredEventArgs)
        e.Password = "telerik"
    End Sub
Unplanned
Last Updated: 15 Mar 2024 07:50 by XicoFininho

Steps to reproduce:

1.Create a zip archive for a txt file with password protection

2. Try updating the protected file and insert a new text line for example.


As a result,  an error occurs: System.ObjectDisposedException: 'Cannot access a closed Stream.'

 
Imports System.IO
Imports System.Text
Imports Telerik.Windows.Zip

Module Module1

    Sub Main()
        Dim sZipFilePath As String = "..\..\test.zip"
        File.Delete(sZipFilePath)

        CreateArchive(sZipFilePath)

        Dim decryptionSettings As DecryptionSettings = EncryptionSettings.CreateDecryptionSettings()
        AddHandler decryptionSettings.PasswordRequired, AddressOf DecryptionSettings_PasswordRequired
        Dim compressionSettings As CompressionSettings = Nothing
        Dim encoding As Encoding = Nothing
        Using oFS As FileStream = File.Open(sZipFilePath, FileMode.OpenOrCreate)


            Using oArchive As ZipArchive = ZipArchive.Update(oFS, encoding, compressionSettings, decryptionSettings)
                For Each entry As ZipArchiveEntry In oArchive.Entries
                    Using entryStream As Stream = entry.Open()
                        Dim reader As New StreamReader(entryStream)
                        Dim content As String = reader.ReadToEnd()

                        entryStream.Seek(0, SeekOrigin.End)
                        Dim writer As New StreamWriter(entryStream)
                        writer.WriteLine("Updated line.")
                        writer.Flush()
                    End Using
                Next
            End Using
        End Using
    End Sub

    Private Sub CreateArchive(sZipFilePath As String)
        Using stream As Stream = File.Open(sZipFilePath, FileMode.Create)
            Dim encryptionSettings As PasswordEncryptionSettings = encryptionSettings.CreatePkzipPasswordEncryptionSettings()
            encryptionSettings.Password = "MyPassword"
            Dim compressionSettings As CompressionSettings = Nothing
            Dim encoding As Encoding = Nothing

            Using archive As ZipArchive = ZipArchive.Create(stream, encoding, compressionSettings, encryptionSettings)

                Using entry As ZipArchiveEntry = archive.CreateEntry("text.txt")
                    Dim writer As StreamWriter = New StreamWriter(entry.Open())
                    writer.WriteLine("Hello world!")
                    writer.Flush()
                End Using
            End Using
        End Using
    End Sub

    Private Sub DecryptionSettings_PasswordRequired(ByVal sender As Object, ByVal e As PasswordRequiredEventArgs)
        e.Password = "MyPassword"
    End Sub

End Module
Unplanned
Last Updated: 08 Mar 2024 06:47 by Joe
When extracting zip archives that contain empty folders with 7zip an error message occurs: "Headers Error"

Unplanned
Last Updated: 02 Mar 2023 10:22 by Joe
Umlaut chars in file names not rendered correctly after extract form archive made with Windows, 7-Zip
Unplanned
Last Updated: 09 Aug 2022 09:18 by ADMIN
The following error is thrown when a zip containing duplicate file names is iterated through:
System.ArgumentException: 'An item with the same key has already been added.'
Unplanned
Last Updated: 11 Oct 2021 15:18 by ADMIN
Writing content into a ZipArchiveEntry using the PdfStreamWriter leads to a wrong offset of the xref table and the objects in it:
MemoryStream ms1 = new MemoryStream();

using (ZipArchive archive = new ZipArchive(ms1, ZipArchiveMode.Create, false, null))
{
	using (PdfFileSource fileSource = new PdfFileSource(File.OpenRead(documentToSplit)))
	{
		string splitDocumentName = "1st page.pdf";
		using (ZipArchiveEntry entry = archive.CreateEntry(splitDocumentName))
		{
			using (PdfStreamWriter writer = new PdfStreamWriter(entry.Open()))
			{
				PdfPageSource page = fileSource.Pages[0];
				writer.WritePage(page);
			}
		}
	}
}

File.WriteAllBytes("exported.zip", ms1.ToArray());


Unplanned
Last Updated: 26 Sep 2019 14:50 by ADMIN
During a ZipArchive creation, when a second stream for creating an entry is opened while the first is still in use the ZipArchive is created with no error message, but the first entry occurs broken (The destination file could not be created).
Unplanned
Last Updated: 03 Dec 2018 12:35 by ADMIN
Telerik.Windows.Zip.InvalidDataException: 'Unknown compression method (0x92)' when initializing a Telerik.Windows.Zip.CompressedStream is thrown for some object streams (read from pdf) due to incorrect transformation header.
Unplanned
Last Updated: 03 Oct 2018 16:42 by ADMIN
7zip and the Windows arvhiver report Data Error on all the files when the users try to extract an archive created with ZipLibrary and the default LzmaSettings.
Unplanned
Last Updated: 20 Sep 2016 11:55 by ADMIN
Reading a password protected archive by passing a wrong password doesn't notify the user that the password is wrong. Accessing one of the entries in the archive throws a generic "Invalid data" exception.

Steps to reproduce:
1. Create a zip file with password.
2. Open the same archive with the API passing wrong password and then try to one of the entries.
Observed: InvalidDataException is thrown when trying to read one of the entries in the archive.
Expected: The exception should be more meaningful and if possible occur when reading the archive. There should be API allowing to check if the password is correct.