From e8a2a6ec166cc6cb7426ac1d7a3cf32aa3ae1901 Mon Sep 17 00:00:00 2001 From: Michael Lane Date: Tue, 20 Aug 2024 17:04:48 +1200 Subject: [PATCH] 361: Don't return filepath.SkipDir from the WalkFunc when excluding symlinked directories, as the item at the path being processed is a symlink and according to https://pkg.go.dev/path/filepath#WalkFunc, returning filepath.SkipDir from WalkFunc when the item being processed is not a directory will skip the parent directory - which is not the desired behavior. --- internal/provider/zip_archiver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/provider/zip_archiver.go b/internal/provider/zip_archiver.go index 014cec10..a0ca3816 100644 --- a/internal/provider/zip_archiver.go +++ b/internal/provider/zip_archiver.go @@ -179,7 +179,10 @@ func (a *ZipArchiver) createWalkFunc(basePath, indirname string, opts ArchiveDir if !opts.ExcludeSymlinkDirectories { return filepath.Walk(realPath, a.createWalkFunc(archivePath, realPath, opts, isArchiveEmpty, dryRun)) } else { - return filepath.SkipDir + // Don't return filepath.SkipDir here, as the item at the path being processed is a symlink + // and according to https://pkg.go.dev/path/filepath#WalkFunc, returning filepath.SkipDir from WalkFunc + // will skip the parent directory containing the symlink, which is not the desired behavior. + return nil } }