From 2463f11e7156aa042e0620d7171064c405764876 Mon Sep 17 00:00:00 2001 From: bplaxco Date: Thu, 5 Jun 2025 09:26:06 -0400 Subject: [PATCH] Fix log suppresion issue (#1887) The check for log suppresion enables archive scanning by default with no max depth. --- sources/file.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sources/file.go b/sources/file.go index daffbfd6..4844c2a4 100644 --- a/sources/file.go +++ b/sources/file.go @@ -55,12 +55,15 @@ func (s *File) Fragments(ctx context.Context, yield FragmentsFunc) error { // and fall back on treating it like a normal file and let fileFragments // decide what to do with it. if err == nil && format != nil { - if (s.archiveDepth+1 > s.MaxArchiveDepth) && s.MaxArchiveDepth != 0 { - logging.Warn().Str( - "path", s.FullPath(), - ).Int( - "max_archive_depth", s.MaxArchiveDepth, - ).Msg("skipping archive: exceeds max archive depth") + if s.archiveDepth+1 > s.MaxArchiveDepth { + // Only warn when the feature is enabled + if s.MaxArchiveDepth != 0 { + logging.Warn().Str( + "path", s.FullPath(), + ).Int( + "max_archive_depth", s.MaxArchiveDepth, + ).Msg("skipping archive: exceeds max archive depth") + } return nil } if extractor, ok := format.(archives.Extractor); ok {