ipfs.files.get() hangs on certain directories #1165
Description
- Version: 0.27.5 and 0.27.4
- Platform:
Linux flux 4.2.0-23-generic #28~14.04.1-Ubuntu SMP Thu Dec 31 13:40:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
(Firefox 57.0.1) - Subsystem: unknown
Type: Bug
Severity: High
Description:
When trying to call ipfs.files.get()
with the multihash of certain directories stored on IPFS, the call responds as expected with an array of files: one for the directory itself (with undefined content), and one for each file such as an index.html (with actual content). An example of such a working multihash is: /ipfs/QmTeW79w7QQ6Npa3b1d5tANreCDxF2iDaAPsDvW6KtLmfB/docs/examples/
However, on other multihashes, calling ipfs.files.get()
never responds and never errors. For instance, this behavior occurs with the following multihash: /ipfs/QmTeW79w7QQ6Npa3b1d5tANreCDxF2iDaAPsDvW6KtLmfB/docs/
.. Note that this is a valid path with actual content as per the ipfs.io gateway: https://gateway.ipfs.io/ipfs/QmTeW79w7QQ6Npa3b1d5tANreCDxF2iDaAPsDvW6KtLmfB/docs/
Expected behavior: Instead of never responding, I would expect ipfs.files.get()
to return an array of files contained in the directory, or at least respond with an error callback.
Steps to reproduce the error:
Save this example repro index.html file, and then open it in your browser: https://gist.githubusercontent.com/witten/bfb32cf627f1fb13acdb9ff70e05f410/raw/9e1adb1a161efaa290df74b205447548b6e5ab8f/index.html
Open your browser console and observe the log trying to get a file
, but then nothing else: No errors, no array of files logged, etc.
Then, edit the file and change the multihash passed to node.files.get()
from .../docs/
to .../docs/examples/
. Reload the page, and note that by making that multihash change, this other directory loads just fine as evidenced by console logging.