From a07a0935fe88a9202e75b01c96ded4a910ba1597 Mon Sep 17 00:00:00 2001 From: aarshkshah1992 Date: Tue, 6 Jul 2021 09:31:52 +0530 Subject: [PATCH] fix bug in CAR generation --- node/impl/client/import.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node/impl/client/import.go b/node/impl/client/import.go index 1d1440d08..475dca1a6 100644 --- a/node/impl/client/import.go +++ b/node/impl/client/import.go @@ -141,6 +141,11 @@ func transformCarToCARv2(inputCARPath string, outputCARv2Path string) (root cid. return cid.Undef, xerrors.New("cannot import CAR with more than one root") } + // we read the file to read the header -> seek to the start again to be able to read again. + if _, err := inputF.Seek(0, io.SeekStart); err != nil { + return cid.Undef, xerrors.Errorf("failed to seek to start of input CAR: %w", err) + } + switch hd.Version { case 2: