From 8fff5e00e14ab9292d1431142fc5b3c60d08fc89 Mon Sep 17 00:00:00 2001 From: liuziba Date: Fri, 1 Jul 2022 22:43:29 -0700 Subject: [PATCH] Always use / as file path separator --- spec/generate-car_spec.rb | 2 ++ util/chunk.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/generate-car_spec.rb b/spec/generate-car_spec.rb index eda9319..8fbf575 100644 --- a/spec/generate-car_spec.rb +++ b/spec/generate-car_spec.rb @@ -4,6 +4,8 @@ after :each do FileUtils.rm_f(Dir['test/*.car']) FileUtils.rm_rf('generated_test') + FileUtils.rm_rf('subfiles_test') + FileUtils.rm_rf('tmpdir') end it 'should work for single file input' do expectIpld = %{ diff --git a/util/chunk.go b/util/chunk.go index 6eb89c7..211c6d1 100644 --- a/util/chunk.go +++ b/util/chunk.go @@ -203,7 +203,7 @@ func GenerateCar(ctx context.Context, fileList []Finfo, parentPath string, tmpDi } node, err = BuildFileNode(ctx, item, dagServ, cidBuilder) dagServ.Add(ctx, node) - cidMap[path] = CidMapValue{false, node.Cid().String()} + cidMap[strings.Join(filepath.SplitList(path), "/")] = CidMapValue{false, node.Cid().String()} if err != nil { logger.Warn(err) return