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

ipfs dht findprovs can't handle /ipfs/$hash #5311

Closed
victorb opened this issue Jul 30, 2018 · 8 comments
Closed

ipfs dht findprovs can't handle /ipfs/$hash #5311

victorb opened this issue Jul 30, 2018 · 8 comments
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws)

Comments

@victorb
Copy link
Member

victorb commented Jul 30, 2018

Version information:

go-ipfs version: 0.4.15-
Repo version: 6
System version: amd64/linux
Golang version: go1.10.2

Type:

Bug

Description:

Trying to find out how many providers there are for a hash and it's link, so wanted to run things via ipfs resolve that returns in the format of /ipfs/$hash. However, ipfs dht findprovs only seems to accept the hashes without the /ipfs prefix. When trying with /ipfs/$hash, the error message is Error: selected encoding not supported

$ ARXIV_HASH=QmfXH9XtP7xmoTH8WAp4HNSduqWMwLTH8B8TvbTkdgzNAa && ipfs resolve "/ipfs/$ARXIV_HASH"
/ipfs/QmfXH9XtP7xmoTH8WAp4HNSduqWMwLTH8B8TvbTkdgzNAa

$ ARXIV_HASH=QmfXH9XtP7xmoTH8WAp4HNSduqWMwLTH8B8TvbTkdgzNAa && ipfs dht findprovs $(ipfs resolve "/ipfs/$ARXIV_HASH")
Error: selected encoding not supported

$ ipfs dht findprovs /ipfs/QmfXH9XtP7xmoTH8WAp4HNSduqWMwLTH8B8TvbTkdgzNAa
Error: selected encoding not supported

$ ipfs dht findprovs QmfXH9XtP7xmoTH8WAp4HNSduqWMwLTH8B8TvbTkdgzNAa
QmTiCerJDqrC6vLDgcNzu8qNK4e9rTx6bJLtSgQHpkUUfk
QmViCToRk7k8asw6B7XNiC8bjomGG26XqXPWWb4WB5HKPL
QmcQzakZ46etK56gWJWqT3GqZRMCw6ovPUWEUBeCf5pUpK
^C
Error: context canceled
@victorb victorb added the kind/bug A bug in existing code (including security flaws) label Jul 30, 2018
@whyrusleeping whyrusleeping added help wanted Seeking public contribution on this issue exp/novice Someone with a little familiarity can pick up labels Jul 30, 2018
@whyrusleeping
Copy link
Member

need to do a path resolution before passing it to the dht, I think we're currently just calling cid.Parse

@grokcoder
Copy link
Contributor

the source code just decode input argument using cid.Decode

c, err := cid.Decode(req.Arguments()[0])
if err != nil {
    res.SetError(err, cmdkit.ErrNormal)
    return
}

so what is the legal input for findprovs, cid or
all of
/ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj
/ipns/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy

are OK? any other format? @whyrusleeping

@victorb
Copy link
Member Author

victorb commented Aug 1, 2018

@grokcoder changing cid.Decode to cid.Parse seems to fix the problem with /ipfs/$hash. Just need to add some additional tests to dht findprovs with the different formats that we pass around as /ipfs/$hash is not tested as a input right now.

@grokcoder
Copy link
Contributor

got it, thx @victorbjelkholm

@x5engine
Copy link

x5engine commented Aug 4, 2018

sorry guys but how do I change that ipfs/$hash path to something like xfiles/$hash?

@Stebalien
Copy link
Member

@meteorplus please keep discussions on-topic.

@x5engine
Copy link

x5engine commented Aug 5, 2018

okay sorry

whyrusleeping added a commit that referenced this issue Aug 5, 2018
fix: dht findprovs unable to handle /ipfs/hash #5311
@Stebalien
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

5 participants