small filename length problem

Apr 29, 2008 at 11:09 AM
Edited Apr 29, 2008 at 11:14 AM
thanks for sharing this small but usefull library code to all of us. (i'm using DotNetZip v1.3)
i hav found a problem regarding to files (folders?) with small names (smaller than 3 chars in length).
if you try to zip a file with a little filename such as "R" (without extension) you get an Subscript out of range error!
i solved this bug by modifying (adding (FileName.Length >= 3) condition to) the code in ZipEntry.cs file as following:

// *** at Line 852:
if ((TrimVolumeFromFullyQualifiedPaths) && (FileName.Length >= 3) && (FileName[1] == ':') && (FileName[2] == '\\')) filenameLength -= 3;

// *** and also at line 878:
char[] c = ((TrimVolumeFromFullyQualifiedPaths) && (FileName.Length >= 3) && (FileName[1] == ':') && (FileName[2] == '\\')) ?
FileName.Substring(3).Replace("\\", "/").ToCharArray() : // trim off volume letter, colon, and slash
FileName.Replace("\\", "/").ToCharArray();

i see another problem, currently we can not zip the files or folders with unicode names!
Jun 7, 2008 at 11:29 PM
Your first issue is a bug - thanks for the note.
I fixed it in the v1.5 code base.
see change set 19765.

This fix will be in the v1.5 final release, but is not yet in the preview release.

As for the other thing you reported - Unicode.  Yes, that is an open issue.