Skip to content

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

@Erotemic

Description

@Erotemic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions