Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ls fails when a directory contains symlinks (or anything that is not a file or directory). #26

Open
Erotemic opened this issue Oct 17, 2023 · 0 comments · May be fixed by #27
Open

Ls fails when a directory contains symlinks (or anything that is not a file or directory). #26

Erotemic opened this issue Oct 17, 2023 · 0 comments · May be fixed by #27

Comments

@Erotemic
Copy link

I ran into an issue where running ls broke because "Type 4" was not recognized.

Unfortunately the ls rest docs are not helpful here:

http://docs.ipfs.tech.ipns.localhost:8080/reference/kubo/rpc/#api-v0-ls

But I was able to find this indicating what the different type codes meant:

https://ipfs-search.readthedocs.io/en/latest/ipfs_datatypes.html
https://github.com/ipfs/go-unixfs/blob/master/pb/unixfs.proto

MWE:

import fsspec

import logging
import sys

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)


import ipfsspec
fs = fsspec.get_filesystem_class('ipfs')

fs = ipfsspec.core.IPFSFileSystem(timeout=100)

cid = "bafybeief7tmoarwmd26b2petx7crtvdnz6ucccek5wpwxwdvfydanfukna"
res = fs._gw_apipost("ls", arg=cid)
links = res["Objects"][0]["Links"]

fs.ls(cid)

I will post up an MR with a fix shortly.

@Erotemic Erotemic linked a pull request Oct 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant