From 5f210c9d35011df8db55b096a531f33f85940910 Mon Sep 17 00:00:00 2001 From: Zach Date: Mon, 28 Apr 2025 09:43:17 -0500 Subject: [PATCH] rm comments --- detect/archive.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/detect/archive.go b/detect/archive.go index 2572ba5e..7f1aef73 100644 --- a/detect/archive.go +++ b/detect/archive.go @@ -28,13 +28,11 @@ func IsArchive(path string) bool { // ExtractArchive extracts all files from archivePath into a temp dir. // Returns the list of ScanTargets (with real file paths) and the temp dir for cleanup. func ExtractArchive(archivePath string) ([]sources.ScanTarget, string, error) { - // 1. Create a temp dir tmpDir, err := os.MkdirTemp("", "gitleaks-archive-") if err != nil { return nil, "", err } - // 2. Open the archive f, err := os.Open(archivePath) if err != nil { os.RemoveAll(tmpDir) @@ -42,7 +40,6 @@ func ExtractArchive(archivePath string) ([]sources.ScanTarget, string, error) { } defer f.Close() - // 3. Identify format (name-based + header peek) ctx := context.Background() format, stream, err := archives.Identify(ctx, archivePath, f) if err != nil { @@ -50,14 +47,13 @@ func ExtractArchive(archivePath string) ([]sources.ScanTarget, string, error) { return nil, "", err } - // 4. Ensure it's extractable extractor, ok := format.(archives.Extractor) if !ok { os.RemoveAll(tmpDir) return nil, "", fmt.Errorf("format %T is not extractable", format) } - // 5. Walk and extract + // Walk and extract var targets []sources.ScanTarget err = extractor.Extract(ctx, stream, func(ctx context.Context, file archives.FileInfo) error { name := file.Name()