Skip to content

Commit e8a2a6e

Browse files
committed
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.
1 parent 95abe9d commit e8a2a6e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/provider/zip_archiver.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ func (a *ZipArchiver) createWalkFunc(basePath, indirname string, opts ArchiveDir
179179
if !opts.ExcludeSymlinkDirectories {
180180
return filepath.Walk(realPath, a.createWalkFunc(archivePath, realPath, opts, isArchiveEmpty, dryRun))
181181
} else {
182-
return filepath.SkipDir
182+
// Don't return filepath.SkipDir here, as the item at the path being processed is a symlink
183+
// and according to https://pkg.go.dev/path/filepath#WalkFunc, returning filepath.SkipDir from WalkFunc
184+
// will skip the parent directory containing the symlink, which is not the desired behavior.
185+
return nil
183186
}
184187
}
185188

0 commit comments

Comments
 (0)