-
Notifications
You must be signed in to change notification settings - Fork 11
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 / listdir fails when using a public gateway because a non-CID path is requested #39
Comments
Thanks for opening this!
Partly, an yes, that's unfortunate, and related to the issue with the HTTP backend. In order to determine whether a CID refers to a directory or a file, and to determine the exact file size, it is required to inspect the root IPLD block behind the CID of the file or directory. To my knowledge, there's no way to request this information from either an IPFS path gateway or a trustless gateway using only a single request to the containing folder. There's also the recommendation for implementing a directory index for an HTTP Gateway, which suggests not to show the actual file size, as it is expensive to compute. Long story short: if using Now the error 406 appears at an interesting place. It seems like
I think the redirect is a resonable choice (it at least should improve the ability to cache things), but it creates an interesting problem:
|
Trustless gateways may not always return raw IPLD blocks when a path is requested. They should however always return car. Fixes #39
Trustless gateways may not always return raw IPLD blocks when a path is requested. They should however always return car. Fixes #39
That already sounds much better than I feared. But, I guess some caching at some level should be done to avoid getting this information more than once. As for the suggestions for remedying the 406 error, that's a bit over my head. |
All of these do work:
The last command does fail when specifying the
IPFS_GATEWAY
environment variableError:
That error 406 can be reproduced with a simple wget on the URL shown in the error message.
The URL already looks wrong. Instead of the structured
https://trustless-gateway.link/ipfs/<CID>/welcome-to-IPFS.jpg?format=raw
, I would have expected it to be simply a CID.Using the simple file CID shown in the working
ls
output, i.e.,wget 'https://trustless-gateway.link/ipfs/bafkreie7ohywtosou76tasm7j63yigtzxe7d5zqus4zu3j6oltvgtibeom?format=raw'
gets me the desired file without an error.Btw, does that mean that a simple
ls
will download all files? Or will it only download the header to determine the file type? Else, this might be running into the same performance problem as the fsspec HTTP backend: fsspec/filesystem_spec#1707The text was updated successfully, but these errors were encountered: