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

Facing an issue with cat-ing the files #1031

Closed
atvanguard opened this issue Oct 1, 2017 · 4 comments
Closed

Facing an issue with cat-ing the files #1031

atvanguard opened this issue Oct 1, 2017 · 4 comments
Assignees

Comments

@atvanguard
Copy link
Contributor

atvanguard commented Oct 1, 2017

  • Version: js-ipfs version: 0.26.0
  • Platform: Darwin Arpits-MBP.Dlink 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
  • Subsystem: CLI

Type: Question

Severity: Low

Description: Trying to follow the IPFS demo video with js-ipfs. Facing an issue with cat-ing the files

Steps to reproduce the error:

➜  jsipfs init

initializing ipfs node at /Users/arpit/.jsipfs
generating 2048-bit RSA keypair...done
peer identity: QmboTK9e8rMroKwEooEn5KRorUu4k2RHjqk9MH4JDNzbvw
to get started, enter:

	 jsipfs files cat /ipfs/QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB

➜  jsipfs files cat /ipfs/QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB

Hello and Welcome to IPFS!

██╗██████╗ ███████╗███████╗
██║██╔══██╗██╔════╝██╔════╝
██║██████╔╝█████╗  ███████╗
██║██╔═══╝ ██╔══╝  ╚════██║
██║██║     ██║     ███████║
╚═╝╚═╝     ╚═╝     ╚══════╝

If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!

 -------------------------------------------------------
| Warning:                                              |
|   This is alpha software. Use at your own discretion! |
|   Much is missing or lacking polish. There are bugs.  |
|   Not yet secure. Read the security notes for more.   |
 -------------------------------------------------------

Check out some of the other files in this directory:

  ./about
  ./help
  ./quick-start     <-- usage examples
  ./readme          <-- this file
  ./security-notes
➜  jsipfs files cat /ipfs/QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB/security-notes
/usr/local/lib/node_modules/ipfs/src/core/components/files.js:92
          callback(null, toStream.source(files[files.length - 1].content))
                                                                ^

TypeError: Cannot read property 'content' of undefined
    at pull.collect (/usr/local/lib/node_modules/ipfs/src/core/components/files.js:92:65)
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/sinks/reduce.js:10:5
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/sinks/drain.js:20:24
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/throughs/flatten.js:35:20
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/throughs/map.js:19:9
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/throughs/map.js:19:9
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/sources/values.js:19:7
    at read (/usr/local/lib/node_modules/ipfs/node_modules/pull-defer/source.js:14:10)
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/throughs/map.js:11:7
    at /usr/local/lib/node_modules/ipfs/node_modules/pull-stream/throughs/map.js:11:7

Am I doing something wrong?

@dryajov
Copy link
Member

dryajov commented Oct 1, 2017

In reality, those files are not located under QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB (./readme), but in the same directory as the readme file, so doing QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB/security-notes is like doing readme/security-notes - there is nothing there. I'm not sure why we don't have the hash of the directory where this files are located as well, so that it can be navigated.

That said, we should not be crashing like this - I'll take a look.

@dryajov dryajov self-assigned this Oct 1, 2017
@atvanguard
Copy link
Contributor Author

I am beginning out with IPFS. I would love to investigate this one.

@dryajov
Copy link
Member

dryajov commented Oct 1, 2017

Absolutely, go for it!

@atvanguard
Copy link
Contributor Author

Hey @dryajov I have made a PR. Do have a look when time permits, thanks!

@daviddias daviddias added the status/ready Ready to be worked label Oct 13, 2017
daviddias pushed a commit that referenced this issue Oct 16, 2017
…-exis… (#1032)

* Fix the welcome message and throw error when trying to cat a non-existent file [Fixes #1031]

* Add tests

* Use CID instead of multihash, fix lint

* Increase cli init basic test timeout
@ghost ghost removed the status/ready Ready to be worked label Oct 16, 2017
dryajov pushed a commit that referenced this issue Oct 26, 2017
…-exis… (#1032)

* Fix the welcome message and throw error when trying to cat a non-existent file [Fixes #1031]

* Add tests

* Use CID instead of multihash, fix lint

* Increase cli init basic test timeout
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants