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

Commit

Permalink
fix: out of scope traversal for 2 or more levels deep
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Oct 26, 2016
1 parent 2e91d7c commit b7a565b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ipld-dag-cbor",
"version": "0.6.0",
"description": "JavaScript implementation of the IPLD (InterpPlanetary Linked Data)",
"main": "src/index.js",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"scripts": {
"test": "aegir-test",
Expand Down Expand Up @@ -49,6 +49,7 @@
"aegir": "8.1.2",
"async": "^2.1.2",
"chai": "^3.5.0",
"ipfs-block": "^0.4.0",
"pre-commit": "^1.1.3"
},
"contributors": [
Expand Down
8 changes: 3 additions & 5 deletions src/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ exports.resolve = (block, path, callback) => {
}

// out of scope

// TODO this was my first try at writting this out of scope traversal code,
// it REALLY needs way more testing.
let value
let len = parts.length

for (let i = 0; i < parts.length; i++) {
let partialPath = parts.shift()
for (let i = 0; i < len; i++) {
const partialPath = parts.shift()

if (Array.isArray(node) && !Buffer.isBuffer(node)) {
value = node[Number(partialPath)]
Expand Down

0 comments on commit b7a565b

Please sign in to comment.