Failed to unzip the File which is zipped by 7Z

0 Answers 221 Views
ZipLibrary
purushotham
Top achievements
Rank 1
purushotham asked on 09 Aug 2023, 06:16 AM
     public void UnzipTSWFiles(string sourceDirectory, string destinationDirectory, string password)
        {
            DefaultEncryptionSettings protectionSettings = new DefaultEncryptionSettings() { Password = password };

                 using (ZipArchive zipArchive = new ZipArchive(output, ZipArchiveMode.Read, true, null, null, protectionSettings))
                        {
                            foreach (ZipArchiveEntry entry in zipArchive.Entries)
                            {
                                using (Stream entryStream = entry.Open())
                                using (FileStream fileStream = File.OpenWrite(string.Format("{0}/{1}", targetDirectory, entry.FullName)))
                                {
                                    entryStream.CopyTo(fileStream);
                                }
                            }
                        }
                    
         

        }
purushotham
Top achievements
Rank 1
commented on 09 Aug 2023, 06:18 AM

Iam able to unzip the file's except the 7Z's
Yoan
Telerik team
commented on 09 Aug 2023, 10:31 AM

Hello,

I tested the extraction of a sample 7-Zip archive on my end and was able to reproduce an 'InvalidDataException: End of Central Directory record could not be found.' error. Can you please share with us whether or not this is similar to your scenario and also what exactly are you experiencing that is unusual?

Attaching a sample archive that reproduces this behavior would also prove very helpful in resolving this case, so if you can please share one with us. I can assure you that anything shared by our clients is treated with strict confidentiality and is used for testing purposes only (as per our EULA section 11).

Thank you in advance for your cooperation.

Regards,

Yoan

purushotham
Top achievements
Rank 1
commented on 21 Aug 2023, 06:54 AM

{Telerik.Zip.InvalidDataException: End of central directory not found.

at Telerik.Zip.ZipArchive.ReadEndOfCentralDirectory() at Telerik.Zip.ZipArchive.Init(Stream stream, ZipArchiveMode mode, Boolean leaveOpen) at Telerik.Zip.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding, CompressionSettings compressionSettings, EncryptionSettings encryptionSettings) at CrownDownloadTool.ViewModels.SimpleMainViewModel.UnzipTSWFiles(String sourceDirectory, String destinationDirectory, String password) 

Peshito
Telerik team
commented on 21 Aug 2023, 01:06 PM

Hello, 

Seems like you have hit a known issue with 7-Zip files and missing end of file record. Please find more information in the public feedback item - ZipLibrary: Import archives without end of central directory record

Regards,
Peshito

 

purushotham
Top achievements
Rank 1
commented on 22 Aug 2023, 02:16 PM

Hello,

Then how can we extract the 7Z's zip files using telerik Zip Library ,If not Possible is there any alternative solution.

Regards,

Purushotham Gowthu

Peshito
Telerik team
commented on 23 Aug 2023, 06:09 AM

Hello,

Even though this is mandatory by the specification some applications do not require it. I am afraid that there is no workaround that could be used. You can subscribe and vote to the feature request to increase its priority and also to get notified when its implementation is done.

Regards,
Peshito

No answers yet. Maybe you can help?

Tags
ZipLibrary
Asked by
purushotham
Top achievements
Rank 1
Share this question
or