2
Vote

Failed to extract a file with invalid chars in its name

description

File names in archive may have some chars which are invalid in Windows file system. For example, angle brackets '<' and '>'. 7zip application replaces them with underscore '_' and has no problem to extract.

I found similar replacement in the source code of SevenZipSharp.ArchiveExtractCallback.ValidateFileName. However, I'm getting an exception from the method Path.Combine in ArchiveExtractCallback,GetStream which precedes the call to ValidateFileName:
fileName = Path.Combine(_directory, _directoryStructure? entryName : Path.GetFileName(entryName));
_archive.GetProperty(index, ItemPropId.IsDirectory, ref data);
try
{
    fileName = ValidateFileName(fileName);
}
catch (Exception e)
{
    AddException(e);
    goto FileExtractionStartedLabel;
}
Please find attached an archive example and try to extract all files using SevenZipSharp to reproduce the problem.

file attachments

comments