Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
fix: resolve link Name or Tsize
Browse files Browse the repository at this point in the history
Resolve to the value of Name or Tsize, do not wrap in IPLD link object.

fixes #85

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
alanshaw authored and vmx committed Sep 11, 2018
1 parent aa6274c commit 981cb9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ exports.resolve = (binaryBlob, path, callback) => {
if (split[2] === 'Hash') {
value = { '/': value.hash }
} else if (split[2] === 'Tsize') {
value = { '/': value.size }
value = value.size
} else if (split[2] === 'Name') {
value = { '/': value.name }
value = value.name
}

remainderPath = split.slice(3).join('/')
Expand Down
4 changes: 2 additions & 2 deletions test/resolver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('IPLD Format resolver (local)', () => {
it('links position path Name', (done) => {
resolver.resolve(linksNodeBlob, 'Links/1/Name', (err, result) => {
expect(err).to.not.exist()
expect(result.value['/']).to.eql(links[1].name)
expect(result.value).to.eql(links[1].name)
expect(result.remainderPath).to.eql('')
done()
})
Expand All @@ -140,7 +140,7 @@ describe('IPLD Format resolver (local)', () => {
it('links position path Tsize', (done) => {
resolver.resolve(linksNodeBlob, 'Links/1/Tsize', (err, result) => {
expect(err).to.not.exist()
expect(result.value['/']).to.eql(links[1].size)
expect(result.value).to.eql(links[1].size)
expect(result.remainderPath).to.eql('')
done()
})
Expand Down

0 comments on commit 981cb9f

Please sign in to comment.