Quantcast
Channel: DotNetZip Library
Viewing all 664 articles
Browse latest View live

New Post: Ionic.Zip.ZipException C#

$
0
0
Hello,

I have this code to decrypt and unzip my files but i get an error on my extractall that ionic zip is not supported by DotNetZip: PKWare AES256?

Any solutions?

foreach (var file in Directory.GetFiles(inPath, "*.zip"))
        {
            string dest = file;

            //Decrypt file using Ionic.Zip.dll.
            using (ZipFile zfile = ZipFile.Read(file))
            {
                zfile.Password = "";                   
                zfile.ExtractAll(Path.GetDirectoryName(file));

            }

            dest = Path.Combine(donePath, Path.GetFileName(file));

            if (File.Exists(dest))
                File.Delete(dest);

            //Move the zip file to Done leaving the unzipped file for handling.
            File.Move(file, dest);
        }
Ionic.Zip.ZipException: Cannot extract: Entry O_DTE4837_FT_3_1608001213_S_160817_011460 is encrypted with an algorithm not supported by DotNetZip: PKWare AES256

Commented Issue: OverflowException when accessing zip file twice [16183]

$
0
0
Hello everybody,

I started using DotNetZip in my application but I have problem when I want to use a zip file twice within my application. For example, first I read my zip file and display the content in my application.

```
using (ZipFile zip = ZipFile.Read(zipPath))
{
...
}
```

Then later, I want to extract the same zip file, therefore I use the same code above and read the zip file into 'zip'. But then I receive an OverflowException:

```
Zip File Error: Cannot read that as a ZipFileSystem.OverflowException: overflow while creating filename
at Ionic.Zip.ZipEntry.CopyHelper.AppendCopyToFileName(String f)
at Ionic.Zip.ZipEntry.ReadDirEntry(ZipFile zf, Dictionary`2 previouslySeen)
at Ionic.Zip.ZipFile.ReadCentralDirectory(ZipFile zf)
at Ionic.Zip.ZipFile.ReadIntoInstance(ZipFile zf) ; File
```

When I close the application and start again, I can do the first step again but not the second. This happens to me every time I start reading to a zip file the second time.

Any idea why I get this exception? Thanks in advance.
Comments: ** Comment from web user: Igulator **

I found the cause and a workaround for this problem.
Ionic.Zip.ZipEntry.CopyHelper.AppendCopyToFileName is called when duplicate filenames are present in the zip file, and attaches "(copy 1)", "(copy 2)" ... to the filenames. I guess to prevent infinite loops there is a hard limit checked at the beginning of the method:

```
callCount++;
if (callCount > 25)
throw new OverflowException("overflow while creating filename");
```

But there is a bug: callCount is a static variable which is never reset, so after you opened zip files with 25 duplicate entries in total, opening _any_ other zip file with at least one duplicate file throws this exception.

A workaround is to reset this counter via reflection, for example:

```
Type copyHelper = typeof(ZipEntry).Assembly.GetTypes().FirstOrDefault(t => t.FullName == "Ionic.Zip.ZipEntry+CopyHelper");
if (copyHelper != null)
{
FieldInfo callCount = copyHelper.GetField("callCount", BindingFlags.Static | BindingFlags.NonPublic);
if (callCount != null)
callCount.SetValue(null, 0);
}
```

New Post: Start extracting from first part like winRAR

$
0
0
I think its about changing the dll but don't know what to change and its so hard for me.
Please make it possible to set the first part as main.

Created Unassigned: Memory leak during ZipFile.Save() and ZipFile.Dispose() [17777]

$
0
0
Team,
I think there is an __Memory leak__ in the DLL as even after calling __Save()__ and __Dispose()__ on the __ZipFile__ object, the "___entries__" dictionary is still holding the values and due to that when I try to add large items, I get __OutOfMemoryException__.

Please suggest if this issue is already known, or if there is any solution proposed for this.

Thanks.
Viewing all 664 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>