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

bug in pathing redirection #49

Closed
jbenet opened this issue Jan 24, 2016 · 4 comments
Closed

bug in pathing redirection #49

jbenet opened this issue Jan 24, 2016 · 4 comments
Labels
kind/bug A bug in existing code (including security flaws) kind/discussion Topical discussion; usually not changes to codebase

Comments

@jbenet
Copy link
Member

jbenet commented Jan 24, 2016

ipfs://ipfs/QmQKRDh2hB2nrP3LpwFMyj8zgi5pjDEQXcEzRLJYVZ45bk/erebor.jpg

goes to

http://127.0.0.1:8080/ipfs/ipfs/QmQKRDh2hB2nrP3LpwFMyj8zgi5pjDEQXcEzRLJYVZ45bk/erebor.jpg

it should go to

http://127.0.0.1:8080/ipfs/QmQKRDh2hB2nrP3LpwFMyj8zgi5pjDEQXcEzRLJYVZ45bk/erebor.jpg

@lidel
Copy link
Member

lidel commented Jan 24, 2016

IIRC current implementation is:

  • fs: – assume full IPFS address (with explicit /pns/ or /ipfs prefix)
  • ipfs: – assume IPFS resource (implicitly add /ipfs prefix)
  • ipns: – assume IPNS resource (implicitly add /ipns prefix)

This raises questions:

  • Should we change this behaviour and always assume full path is provided?
  • Or should we just detect duplicate /ipfs/ and remove it silently?
  • Potential problem:
    What about ipns://ipfs/QmQKRDh2hB2nrP3LpwFMyj8zgi5pjDEQXcEzRLJYVZ45bk/erebor.jpg ?
    What should happen then?

@lidel lidel added the kind/discussion Topical discussion; usually not changes to codebase label Jan 24, 2016
@Kubuxu
Copy link
Member

Kubuxu commented Jan 24, 2016

We should accept as many formats and show only one. This way if user makes mistake while inputting he gets redirected to a correct one and when he wants to share (copy&paste) he shares the correct one.

Fixing ipns://ipfs/QmQKRDh2hB2nrP3LpwFMyj8zgi5pjDEQXcEzRLJYVZ45bk/erebor.jpg to canonical /ipfs/QmQKRDh2hB2nrP3LpwFMyj8zgi5pjDEQXcEzRLJYVZ45bk/erebor.jpg (which will be shown in browser probably with fs:/ prefix) makes sense from usability perspective.

@lidel lidel added the kind/bug A bug in existing code (including security flaws) label Jan 24, 2016
@lidel
Copy link
Member

lidel commented Jan 24, 2016

Yeah, it should follow robustness principle and be liberal in what addon accepts for each protocol handler.

Marking as a bug to be fixed in next release.

@lidel lidel closed this as completed in 9d7ea4e Jan 24, 2016
@lidel
Copy link
Member

lidel commented Jan 24, 2016

Fix will be available in v1.4.2:

  • if protocol prefix is present in path, leave it as-is
  • if protocol prefix is missing, add default one from handler template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) kind/discussion Topical discussion; usually not changes to codebase
Projects
None yet
Development

No branches or pull requests

3 participants