diff --git a/core/commands/ls.go b/core/commands/ls.go index 566e0ad0135b..dba8e5afa676 100644 --- a/core/commands/ls.go +++ b/core/commands/ls.go @@ -26,7 +26,7 @@ import ( type LsLink struct { Name, Hash string Size uint64 - Type unixfspb.Data_DataType + Type string } type LsObject struct { @@ -48,6 +48,15 @@ the following format: The JSON output contains type information. +The path can be a prefixless ref; in this case, we assume it to be an +/ipfs ref and not /ipns. + +Example: + + > ipfs file ls QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ + cat.jpg + > ipfs file ls /ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ + cat.jpg `, }, @@ -162,7 +171,7 @@ The JSON output contains type information. Name: link.Name, Hash: link.Cid.String(), Size: link.Size, - Type: t, + Type: t.String(), } } } @@ -193,7 +202,7 @@ The JSON output contains type information. fmt.Fprintln(w, "Hash\tSize\tName") } for _, link := range object.Links { - if link.Type == unixfspb.Data_Directory { + if link.Type == unixfspb.Data_Directory.String() { link.Name += "/" } fmt.Fprintf(w, "%s\t%v\t%s\n", link.Hash, link.Size, link.Name)