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

Commit 981cb9f

Browse files
alanshawvmx
authored andcommitted
fix: resolve link Name or Tsize
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>
1 parent aa6274c commit 981cb9f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/resolver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ exports.resolve = (binaryBlob, path, callback) => {
5959
if (split[2] === 'Hash') {
6060
value = { '/': value.hash }
6161
} else if (split[2] === 'Tsize') {
62-
value = { '/': value.size }
62+
value = value.size
6363
} else if (split[2] === 'Name') {
64-
value = { '/': value.name }
64+
value = value.name
6565
}
6666

6767
remainderPath = split.slice(3).join('/')

test/resolver.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('IPLD Format resolver (local)', () => {
131131
it('links position path Name', (done) => {
132132
resolver.resolve(linksNodeBlob, 'Links/1/Name', (err, result) => {
133133
expect(err).to.not.exist()
134-
expect(result.value['/']).to.eql(links[1].name)
134+
expect(result.value).to.eql(links[1].name)
135135
expect(result.remainderPath).to.eql('')
136136
done()
137137
})
@@ -140,7 +140,7 @@ describe('IPLD Format resolver (local)', () => {
140140
it('links position path Tsize', (done) => {
141141
resolver.resolve(linksNodeBlob, 'Links/1/Tsize', (err, result) => {
142142
expect(err).to.not.exist()
143-
expect(result.value['/']).to.eql(links[1].size)
143+
expect(result.value).to.eql(links[1].size)
144144
expect(result.remainderPath).to.eql('')
145145
done()
146146
})

0 commit comments

Comments
 (0)