C1Zip throws exception

Posted by: andreas.kren on 25 July 2019, 10:44 am EST

    • Post Options:
    • Link

    Posted 25 July 2019, 10:44 am EST

    The code below throws an exception

    “Der Zugriff auf den Pfad “c:\del\test.20190725\languages” wurde verweigert.” which means 'access denied" on a certain subdirectory within the zip file

    when I unzip the zip file manually with a tool like WinRar/Winzip it simply works.

    C1Zip version is: 4.0.20182.314

    I cant upload the zip file here, data within is a little sensible.

    Any ideas?

    ============================================================

                        If C1ZipFile.IsZipFile(CmsDatenDatei) Then
                            Try
                                Dim myZip As New C1ZipFile
                                myZip.UseUtf8Encoding = True
                                myZip.Open(CmsDatenDatei)
                                myZip.Entries.ExtractFolder("c:\del\test")
                                myZip.Close()
    
                                IO.File.Delete(CmsDatenDatei)
    
                            Catch ex As Exception
                                Call Protozeile("Hole_KioskDaten) S12) Entpacke Datendatei" & CmsDatenDatei & vbCrLf & ex.Message.ToString)
                            End Try
                        End If
    
  • Posted 25 July 2019, 11:03 am EST

    …“\languages.…” is the first subdir in the zip, so when the first file of that subdir should be unzipped, the exception is thrown. sth like user permissions?

    should i send you the zip? if so, where to Send?

  • Posted 26 July 2019, 5:34 am EST

    Hello,

    I tried using your code at my end with a zip file but the issue was not observed. Refer the attached application.

    Please try executing your application with the latest release builds:

    https://www.dropbox.com/s/81vl14208xohf8t/C1WinForms.4_4.0.20192.375.zip?dl=0

    If it does not help, share your zip file here: https://www.dropbox.com/request/z1uDpZ3rcjKIg7ZhaFax

    Regards,

    EshaC1Zip_Extract.zip

  • Posted 26 July 2019, 6:23 am EST

    Tried it , no change

    Also changed the line int above code

    myZip.Entries.ExtractFolder(“c:\del\test”)

    To

    myZip.Entries.ExtractFolder(“d:\del\test2”)

    so that the directory is explictely created by the c1Zip component.

  • Posted 26 July 2019, 6:23 am EST

    And sent you the zip File…

  • Posted 26 July 2019, 6:53 am EST

    Solved it my self using the .NET own namespace; my guess is that within the zip file (coming from another system) the path seperator seems to be “/” instead of "" (windows, ntfs), and c1zip component is not able to handle this.

    does not work:

                            Try
                                Dim myZip As New C1ZipFile
                                myZip.UseUtf8Encoding = True
                                myZip.Open(CmsDatenDatei)
    
                                CmsDatenPfad = Path.GetDirectoryName(CmsDatenDatei) & "\CmsDaten" & "." & Format(Now, "yyyyMMddHHmmss")
                                ''                                CmsDatenPfad = "D:\del\test2"
                                myZip.Entries.ExtractFolder(CmsDatenPfad)
                                myZip.Close()
    
                                '                                IO.File.Delete(CmsDatenDatei)
    
                                'ZipFile.ExtractToDirectory(CmsDatenDatei, CmsDatenPfad)
    
                            Catch ex As Exception
                                Call Protozeile("Hole_KioskDaten) S12) Entpacke Datendatei" & CmsDatenDatei & vbCrLf & ex.Message.ToString)
                            End Try
    

    works:

                            Try
                                'Dim myZip As New C1ZipFile
                                'myZip.UseUtf8Encoding = True
                                'myZip.Open(CmsDatenDatei)
    
                                CmsDatenPfad = Path.GetDirectoryName(CmsDatenDatei) & "\CmsDaten" & "." & Format(Now, "yyyyMMddHHmmss")
                                ''                                CmsDatenPfad = "D:\del\test2"
                                'myZip.Entries.ExtractFolder(CmsDatenPfad)
                                'myZip.Close()
    
                                ZipFile.ExtractToDirectory(CmsDatenDatei, CmsDatenPfad)
    
                                '                                IO.File.Delete(CmsDatenDatei)
    
    
                            Catch ex As Exception
                                Call Protozeile("Hole_KioskDaten) S12) Entpacke Datendatei" & CmsDatenDatei & vbCrLf & ex.Message.ToString)
                            End Try
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels