Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

FastZip.CreateZip crashes when used with certain buggy Directory enumeration on .NET 5

Aperta
#676 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
tooling

Direzione di ricerca

Inizia in FastZip.cs, intorno alla riga indicata, e verifica come CreateZip utilizza FileSystemScanner. Esamina il punto di estensione richiesto e la soluzione alternativa fornita per l'enumerazione, quindi conferma che un chiamante può fornire uno scanner personalizzato per il caso .NET 5 descritto senza che FastZip.CreateZip fallisca.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement zip

Not really a bug, more like a feature suggestion.

Steps to reproduce
  1. In .net 5, directory enumeration has bugs with WebDav (https://github.com/dotnet/runtime/issues/46723#issuecomment-928090089), not fixed in .net 6 and with no other immediate official solution in sight;
  2. This causes crashes when calling FastZip.CreateZip as the GetDirectories/GetFiles return invalid data;
  3. A workaround is available - use something like this on the GetDirectories-returned data:
public static string[] FixupNet5Enumeration(string[] items)
{
    return items
        .Select(t => t.TrimEnd('\0'))
        .Where(t => {
            var itemName = Path.GetFileName(t);
            return itemName != "." && itemName != "..";
        })
        .ToArray();
}
  1. SharpZipLib nicely wraps the Directory.GetDirectories call into the FileSystemScanner class. However it is not possible to supply custom FileSystemScanners to FastZip.CreateZip. It would be helpful in this case as I could just copy that class and insert the required fixup calls. It would be necessary to create an interface around FileSystemScanner and to change to public the method

https://github.com/icsharpcode/SharpZipLib/blob/612969e574fd9d922314f24923792e343871f102/src/ICSharpCode.SharpZipLib/Zip/FastZip.cs#L477

What do you think?

Expected behavior

FastZip.CreateZip should offer an override to specify custom FileSystemScanners.

Actual behavior

FastZip.CreateZip throws exception as the paths returned by Directory.GetDirectories are not valid paths.

Version of SharpZipLib

1.3.3

Obtained from (only keep the relevant lines)
  • Package installed using NuGet
Lingua principale
C#
Stelle
3.9k
Fork
1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di icsharpcode/SharpZipLib

Tutte le issue di icsharpcode/SharpZipLib

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.