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

CIDs containing "/" cannot be parsed #54

Open
hsanjuan opened this issue Mar 7, 2022 · 4 comments
Open

CIDs containing "/" cannot be parsed #54

hsanjuan opened this issue Mar 7, 2022 · 4 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@hsanjuan
Copy link
Contributor

hsanjuan commented Mar 7, 2022

Currently there is no way to express a path that contains a base64-formatted CID when it contains forward slashes.

Perhaps there should be a way of scaping "/" in the CID element of paths (which I think are either <CID>/path or /ipfs/<CID>/path or /ipns/<CID>/path).

@hsanjuan hsanjuan added the need/triage Needs initial labeling and prioritization label Mar 7, 2022
@ribasushi
Copy link

ribasushi commented Mar 7, 2022

@hsanjuan see also ipfs/kubo#7739

I personally just switched everything I do to b64urlenc ( u multibase ), but that's hardly a generic solution

@Jorropo
Copy link

Jorropo commented Mar 7, 2022

@hsanjuan see also ipfs/go-ipfs#7739

I personally just switched everything I do to b64urlenc ( u multibase ), but that's hardly a generic solution

This came from a discourse post, where I've said the exact same thing :D
https://discuss.ipfs.io/t/how-are-base64-encoded-cids-handled-when-they-have-in-them/13656/2?u=jorropo

I guess what we want is backslash escaping of / characters. So you could use base64, if you escape /.

@thattommyhall
Copy link
Member

thattommyhall commented Mar 7, 2022

I should point out that I asked in the context of operating the PL gateway, where I am not in control of what people request

@markg85
Copy link

markg85 commented Mar 7, 2022

Would it not be sane to just remove the option to do base64 formatting. That format is just always going to cause troubles when used in a path context. A context that's likely in IPFS. On top of that, the proper alternative for it (b64urlenc) is there too.

I'd go as far as looking at all formatting options and kicking out all those that could break a path unintentionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

5 participants