Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid max read size reached error when cmp imported files #618

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/stacker/import.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package stacker

import (
"io"
"io/fs"
"os"
"path"
Expand Down Expand Up @@ -59,7 +60,11 @@ func filesDiffer(p1 string, info1 os.FileInfo, p2 string, info2 os.FileInfo) (bo
}
defer f2.Close()

eq, err := equalfile.New(nil, equalfile.Options{}).CompareReader(f1, f2)
// use limited reader to prevent the default cap of 10**10 max file size
limf1R := io.LimitReader(f1, info1.Size())
limf2R := io.LimitReader(f2, info2.Size())

eq, err := equalfile.New(nil, equalfile.Options{}).CompareReader(limf1R, limf2R)
if err != nil {
return false, err
}
Expand Down
Loading