Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

correct file size for raw node #88

Merged
merged 2 commits into from
Apr 21, 2021
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
4 changes: 2 additions & 2 deletions unixfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ func size(pbdata *pb.Data) (uint64, error) {
switch pbdata.GetType() {
case pb.Data_Directory, pb.Data_HAMTShard:
return 0, errors.New("can't get data size of directory")
case pb.Data_File:
case pb.Data_File, pb.Data_Raw:
return pbdata.GetFilesize(), nil
case pb.Data_Symlink, pb.Data_Raw:
Copy link
Author

@coryschwartz coryschwartz Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Raw types, data 0 bytes in the data section, but the filesize is set.

i.e.

Type:Raw Data:"" filesize:114178 blocksizes:114178

case pb.Data_Symlink:
return uint64(len(pbdata.GetData())), nil
default:
return 0, errors.New("unrecognized node data type")
Expand Down