Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

URLs for IPFS paths #287

Closed
achingbrain opened this issue May 30, 2018 · 3 comments
Closed

URLs for IPFS paths #287

achingbrain opened this issue May 30, 2018 · 3 comments

Comments

@achingbrain
Copy link
Collaborator

I'd asked this question on #284 but it's a bit of a tangent so I've moved it here.

Is there a reason we don't support URLs to indicate which kind of paths are which?

e.g. ipfs://QmPbFXUdgtyrCjExNAjugJTro6Lx4GG4MuvXTiHcZQkiif, ipfs:///a-file-in-mfs, file:///home/me/some-file.txt etc?

It would make the users' intentions clearer when trying to work out what they wanted to copy/move/add/etc, specifically in the case where they have valid MFS/filesystem paths that clash with filesystem/MFS or IPFS paths. E.g. they've got a file in MFS at /etc/passwd or on the filesystem at/ipfs/QmPbFXUdgtyrCjExNAjugJTro6Lx4GG4MuvXTiHcZQkiif.

If we detect a conflict while using regular paths we could prompt the user to re-specify their args using URLs.

Something like:

$ mkdir /ipfs
$ touch /ipfs/QmPbFXUdgtyrCjExNAjugJTro6Lx4GG4MuvXTiHcZQkiif
$ ipfs files cp /ipfs/QmPbFXUdgtyrCjExNAjugJTro6Lx4GG4MuvXTiHcZQkiif /hello.txt

Cannot copy file

A local file was detected at /ipfs/QmPbFXUdgtyrCjExNAjugJTro6Lx4GG4MuvXTiHcZQkiif 
which is also an IPFS path.  Please use file:// or ipfs:// URLs.

E.g.:
ipfs files cp ipfs://QmPbFXUdgtyrCjExNAjugJTro6Lx4GG4MuvXTiHcZQkiif /hello.txt
ipfs files cp file:///ipfs/QmPbFXUdgtyrCjExNAjugJTro6Lx4GG4MuvXTiHcZQkiif /hello.txt
@olizilla
Copy link
Contributor

olizilla commented Jun 1, 2018

More generally, we should consider supporting all 4 flavours of IPFS address where ever a CID is currently supported.

We could implement the logic once to convert all 4 into /<namespace>/<cid>/<path> for the rest of the code to work with, and save the application layer the work of having to convert them.

@travisperson
Copy link
Contributor

There is a pretty extensive discussion around this a while back.

Summary by Juan (Worth reading though if you want to understand reasoning)
ipfs/kubo#1678 (comment)

@alanshaw
Copy link
Contributor

alanshaw commented Jun 5, 2018

For anyone coming to this issue, this document is also good background context, particularly the linked section:
https://github.com/lidel/specs/tree/dweb-addressing/dweb-addressing#interoperability

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants