ipfs / ipfs/kubo

merkledag\coding.go change links order if it have names in file nodes.

Open
#4,705 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

#### Version information:
go-ipfs version: 0.4.13-
Repo version: 6
System version: amd64/windows
Golang version: go1.9.2

#### Type: Bug

#### Description:

Wrong order:
```
>ipfs dag get QmQigZekUpTrhwzoZ1zyfuq3kLvsBRR73chktinPhkewqG
{"data":"CAIYgGQggFwggAQggAQ=",
"links":[
{"Name":"","Size":512,"Cid":{"/":"zb2rhX9DvypVUCrp1SyoB6JpvdNEGcujJm7RZ6btt1zJBvnKq"}},
{"Name":"","Size":512,"Cid":{"/":"zb2rhX9DvypVUCrp1SyoB6JpvdNEGcujJm7RZ6btt1zJBvnKq"}},
{"Name":"test","Size":13388,"Cid":{"/":"QmYPWmgDtUNwLN1CfWnRWcEnfBk1ANLXAeYeoHeCuNNWFE"}}
]}
```

Right order:
```
>ipfs dag get QmQigZekUpTrhwzoZ1zyfuq3kLvsBRR73chktinPhkewqG
{"data":"CAIYgGQggFwggAQggAQ=",
"links":[
{"Name":"test","Size":13388,"Cid":{"/":"QmYPWmgDtUNwLN1CfWnRWcEnfBk1ANLXAeYeoHeCuNNWFE"}},
{"Name":"","Size":512,"Cid":{"/":"zb2rhX9DvypVUCrp1SyoB6JpvdNEGcujJm7RZ6btt1zJBvnKq"}},
{"Name":"","Size":512,"Cid":{"/":"zb2rhX9DvypVUCrp1SyoB6JpvdNEGcujJm7RZ6btt1zJBvnKq"}}
]}
```

It is file node. Sorting breaks the file.

https://github.com/ipfs/go-ipfs/blob/28acec2adb7c7cfe30c458b9fd7bf70768d9e26c/merkledag/coding.go#L37
https://github.com/ipfs/go-ipfs/blob/28acec2adb7c7cfe30c458b9fd7bf70768d9e26c/merkledag/coding.go#L61
https://github.com/ipfs/go-ipfs/blob/28acec2adb7c7cfe30c458b9fd7bf70768d9e26c/merkledag/coding.go#L80

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.