diff --git a/pkg/stacker/import.go b/pkg/stacker/import.go index c7eb13fe..965a17a7 100644 --- a/pkg/stacker/import.go +++ b/pkg/stacker/import.go @@ -1,6 +1,7 @@ package stacker import ( + "io" "io/fs" "os" "path" @@ -59,10 +60,11 @@ func filesDiffer(p1 string, info1 os.FileInfo, p2 string, info2 os.FileInfo) (bo } defer f2.Close() - // check filesize first, if equal, then use a limitedReader set to the - // file size + // 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(f1, f2) + eq, err := equalfile.New(nil, equalfile.Options{}).CompareReader(limf1R, limf2R) if err != nil { return false, err }