ligi / IPFSDroid

Android App for the InterPlanetary File System(IPFS)
GNU General Public License v3.0
304 stars 73 forks source link

URL convention is inconsistent with one recommended by IPFS #5

Closed Kubuxu closed 8 years ago

Kubuxu commented 8 years ago

IPFS recommends using either canonical form. Examples: /ipfs/Qm.... /ipns/Qm... If protocol is required use authority less fs protocol. Examples: fs:/ipfs/Qm.... fs:/ipns/Qm... - notice lack of double slash

See: https://github.com/ipfs/go-ipfs/issues/1678#issuecomment-157478515

ligi commented 8 years ago

Thanks for the hint - there is now support for fs://ipfs/ and fs://ipns/ - so that means now I just have to remove ipfs:// and ipns:// support and this can be closed? I thought fs://* is additional to ipns:// and ipfs://

ghost commented 8 years ago

@ligi it should always be fs:/ipfs/and-so-on -- with one slash it's authority-less and the path is /ipfs/and-so-on as expected, while with two slashes the URI has an authority (or hostname), which is not what we want.

The same applies to the other supported but not-preferred schemas: ipfs:, web+fs:, and web+ipfs:.

Btw I'll be happy to help out whenever you run into Android+IPFS issues -- I ported cjdns to Android in the past and I know it can be a little challenging at times :)

ligi commented 8 years ago

Interesting - first I thought this is not possible for Intent-Filters on android as the documentation states:

A URI is specified by separate attributes for each of its parts:
<scheme>://<host>:<port>[<path>|<pathPrefix>|<pathPattern>]

http://developer.android.com/guide/topics/manifest/data-element.html

But I just did some experiments and it seems to be possible to write an intent-filter to match this kind of URIs. But this has 2 drawbacks: 1: I cannot limit the intent filter to fs:/ipfs and fs:/ipns it only seems to be possible to match fs:/* - pathPattern is ignored and host like I used before to limit to fs://ipfs and fs://ipns is not working when only using one slash 2: It is off documentation and the behavior I have seen in my experiments might not be guaranteed on all devices

Just asked on StackOverflow to get some more input on this: http://stackoverflow.com/questions/36994704/intent-filters-with-pathpattern-for-authority-less-uris

ligi commented 8 years ago

I added authority-less URI support with a34a4797f85d59579010627e7af591a2322bd62e - but not yet feel good about the broad intent-filters for all of fs:/* - but not yet found a way around it - perhaps we should report this need upstream to android to get the ability to have narrower filters for authority-less URIs

ghost commented 8 years ago

fs:/* is just fine -- more things will come in the future and /ipfs and /ipns are only the first ones.

ligi commented 8 years ago

Great! then I saw problems where none is and I can close this issue as it is solved with a34a479