Skip to content

Commit

Permalink
ls: resolve symlinks
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Steven Allen <[email protected]>
  • Loading branch information
Stebalien committed Mar 7, 2019
1 parent 8162139 commit c6d85c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/commands/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type LsLink struct {
Name, Hash string
Size uint64
Type unixfs_pb.Data_DataType
Target string
}

// LsObject is an element of LsOutput
Expand Down Expand Up @@ -159,8 +160,9 @@ The JSON output contains type information.
Name: link.Name,
Hash: enc.Encode(link.Cid),

Size: link.Size,
Type: ftype,
Size: link.Size,
Type: ftype,
Target: link.Target,
}
if err := processLink(paths[i], lsLink); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions core/coreapi/unixfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ func (api *UnixfsAPI) processLink(ctx context.Context, linkres ft.LinkResult, se
lnk.Type = coreiface.TDirectory
case ft.TSymlink:
lnk.Type = coreiface.TSymlink
lnk.Target = string(d.Data())
}
lnk.Size = d.FileSize()
}
Expand Down

0 comments on commit c6d85c2

Please sign in to comment.