mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
one tmp dir to rule them all, I think
This commit is contained in:
1 parent
56e409d9f1
commit
e0ea9cefde
7 files changed
+58
-41
No files matched your search
+4
-8
@@ -43,10 +43,10 @@ func (d *Detector) detectScanTarget(scanTarget sources.ScanTarget) error {
|
||||
logger.Trace().Msg("Scanning path")
|
||||
|
||||
// --- Archive branch: extract and reschedule children ---
|
||||
if IsArchive(scanTarget.Path) {
|
||||
logger.Info().Msg("Found archive")
|
||||
if isArchive(scanTarget.Path) {
|
||||
logger.Debug().Msg("Found archive")
|
||||
|
||||
targets, tmpdir, err := ExtractArchive(scanTarget.Path)
|
||||
targets, tmpArchiveDir, err := extractArchive(scanTarget.Path)
|
||||
if err != nil {
|
||||
logger.Warn().Err(err).Msg("Failed to extract archive")
|
||||
return nil
|
||||
@@ -55,7 +55,7 @@ func (d *Detector) detectScanTarget(scanTarget sources.ScanTarget) error {
|
||||
for _, t := range targets {
|
||||
t := t
|
||||
// compute path INSIDE this archive
|
||||
rel, rerr := filepath.Rel(tmpdir, t.Path)
|
||||
rel, rerr := filepath.Rel(tmpArchiveDir, t.Path)
|
||||
if rerr != nil {
|
||||
rel = filepath.Base(t.Path)
|
||||
}
|
||||
@@ -73,10 +73,6 @@ func (d *Detector) detectScanTarget(scanTarget sources.ScanTarget) error {
|
||||
})
|
||||
}
|
||||
|
||||
// cleanup extraction directory
|
||||
// if err := os.RemoveAll(tmpdir); err != nil {
|
||||
// logger.Warn().Err(err).Msg("Failed to remove tempdir")
|
||||
// }
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user