From 81f9e06b11ad6ba424f8311c0bc18ceb01f2b67a Mon Sep 17 00:00:00 2001 From: Shelton Zhu <498220739@qq.com> Date: Tue, 23 Jan 2024 11:00:47 +0800 Subject: [PATCH] 7z: Copy f for loop closure (#394) fix: fix iteration bug --- 7z.go | 1 + 1 file changed, 1 insertion(+) diff --git a/7z.go b/7z.go index 44f8a00b..d57bd452 100644 --- a/7z.go +++ b/7z.go @@ -82,6 +82,7 @@ func (z SevenZip) Extract(ctx context.Context, sourceArchive io.Reader, pathsInA skipDirs := skipList{} for i, f := range zr.File { + f := f // make a copy for the Open closure if err := ctx.Err(); err != nil { return err // honor context cancellation }