From 64028e25af549ff8beb3c206564a66dae547443b Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Wed, 27 Aug 2025 11:53:44 +0200 Subject: [PATCH] fix: improve mapresponses and profiles extraction in hi tool - Fix directory hierarchy flattening by using full paths instead of filepath.Base() - Remove redundant container hostname prefixes from directory names - Strip top-level directory from tar extraction to avoid nested structure - Ensure parent directories exist before creating files - Results in clean structure: control_logs/mapresponses/1-ts-client/file.json --- integration/hsic/hsic.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/integration/hsic/hsic.go b/integration/hsic/hsic.go index 22250eb4..5686dd29 100644 --- a/integration/hsic/hsic.go +++ b/integration/hsic/hsic.go @@ -641,7 +641,6 @@ func extractTarToDirectory(tarData []byte, targetDir string) error { } } - // Second pass: extract files, stripping the top-level directory tarReader = tar.NewReader(bytes.NewReader(tarData)) for { header, err := tarReader.Next() @@ -665,7 +664,6 @@ func extractTarToDirectory(tarData []byte, targetDir string) error { // Skip the top-level directory itself continue } - // Skip empty paths after stripping if cleanName == "" { continue @@ -684,7 +682,6 @@ func extractTarToDirectory(tarData []byte, targetDir string) error { if err := os.MkdirAll(filepath.Dir(targetPath), 0o755); err != nil { return fmt.Errorf("failed to create parent directories for %s: %w", targetPath, err) } - // Create file outFile, err := os.Create(targetPath) if err != nil {