Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Proposed fix for Issue #3330: files/ls should return string for type (not integer) #3345

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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 packages/ipfs-core/src/components/files/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const {
* @returns {UnixFSEntry}
*/
const toOutput = (fsEntry) => {
let type = 0
let type = 'file'
let size = fsEntry.node.size || fsEntry.node.length
let mode
let mtime

if (fsEntry.unixfs) {
size = fsEntry.unixfs.fileSize()
type = MFS_FILE_TYPES[fsEntry.unixfs.type]
type = Object.entries(MFS_FILE_TYPES).find(x => x[1] == fsEntry.unixfs.type)[0]
mode = fsEntry.unixfs.mode
mtime = fsEntry.unixfs.mtime
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.OFFLINE_ERROR = 'This command must be run in online mode. Try running \'
exports.MFS_FILE_TYPES = {
file: 0,
directory: 1,
'hamt-sharded-directory': 1
'hamt-sharded-directory': 2
}
exports.MFS_ROOT_KEY = new Key('/local/filesroot')
exports.MFS_MAX_CHUNK_SIZE = 262144
Expand Down