Skip to content

Commit

Permalink
fix: files ls should return string (#3352)
Browse files Browse the repository at this point in the history
Supersedes #3345 #2939
Fixes #3330 #2948

BREAKING CHANGE: types returned by `ipfs.files.ls` are now strings, in line with the docs but different to previous behaviour

Co-authored-by: Geoffrey Cohler <g.cohler@computer.org>
  • Loading branch information
achingbrain and gcohler committed Oct 27, 2020
1 parent a247b50 commit a6898ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/files/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ module.exports = configure(api => {
})

function toCoreInterface (entry) {
if (entry.hash) entry.cid = new CID(entry.hash)
if (entry.hash) {
entry.cid = new CID(entry.hash)
}

delete entry.hash

entry.type = entry.type === 1 ? 'directory' : 'file'

return entry
}

0 comments on commit a6898ac

Please sign in to comment.