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://CIDv0 (ipfs://Qm…) becomes lowercase and doesn't work on firefox 89 #1006

Closed
SuzanneSoy opened this issue Jun 7, 2021 · 4 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@SuzanneSoy
Copy link

SuzanneSoy commented Jun 7, 2021

When accessing ipfs://QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG, the link is converted to lowercase, and an error message appears because of that.

To Reproduce

  1. Install ipfs-companion 2.19.0 on Firefox 89 from https://addons.mozilla.org/en-US/firefox/addon/ipfs-companion/
  2. start ipfs daemon on the command-line
  3. copy-paste this into the URL bar: ipfs://QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG
  4. the url rapidly changes to ipfs://qmuvtksryjpaxut7dr9fpkq6aokhhem7eg1zhgl56haklg and then to https://dweb.link/ipfs/qmuvtksryjpaxut7dr9fpkq6aokhhem7eg1zhgl56haklg which shows the following error:
invalid ipfs path: invalid path "/ipfs/qmuvtksryjpaxut7dr9fpkq6aokhhem7eg1zhgl56haklg": invalid CID: selected encoding not supported (possible lowercased CIDv0; consider converting to a case-agnostic CIDv1, such as base32)

Expected behaviour

The URL should stay ipfs://QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG or be converted to http://QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG.ipfs.localhost:8080/ or some other proxy, and a page containing the text Hello IPFS should appear.

Screenshots
20210607_05h39m26s_grim

Desktop

  • OS: Linux (Ubuntu 20.04 Focal, ipfs installed via nixpkgs)
  • Browser: Firefox 89.0 64-bit (installed via nixpkgs)
  • ipfs --version: ipfs version 0.8.0
  • ipfs-companion version: 2.19.0

Additional context

A similar issue has been reported in the past, and closed as fixed: #815

@SuzanneSoy SuzanneSoy added the need/triage Needs initial labeling and prioritization label Jun 7, 2021
@ipfs ipfs deleted a comment from welcome bot Jun 11, 2021
@lidel
Copy link
Member

lidel commented Jun 11, 2021

Thank you for reporting this.

Unfortunately, the lowercasing is performed by Firefox before URL is passed to gateway or can be converted to CIDv1 by Companion, so we can't do anything about it.

You should follow the advice from the error message and convert CID to case-insensitive base32.
This can be done on https://cid.ipfs.io or in command line via ipfs cid base32 Qm..

In near future this issue will be less prominent because we are going to switch to CIDv1 in base32 as the default (ipfs/kubo#4143)

@Atemu
Copy link

Atemu commented Sep 20, 2021

Has anyone gotten in touch with Mozilla about this? Perhaps they could be trivially alleviate this issue on their end.

Obviously CIDv1 is the solution going forward but there are lots of CIDv0 links still out there. My first real contact with IPFS happened just a few minutes ago and it was a CIDv0 which then triggered this issue. It's not a huge problem since linkifying ipfs URLs usually obviates the need for pasting one into the browser bar but that's not enabled by default.

I also got a very user-unfriendly error message which isn't great:

invalid ipfs path: invalid path "/ipfs/qmyhcm6myg2fsgfik5hksa8eahwrpq2wdpxxmjhamdsn17": invalid CID: selected encoding not supported (possible lowercased CIDv0; consider converting to a case-agnostic CIDv1, such as base32)

@lidel
Copy link
Member

lidel commented Sep 21, 2021

It is not just Mozilla, other apps and libraries force-lowercase on URIs as well.
Expecting that all user agents change the way they parse URI/URL is not realistic imo – better to invest time in things like finishing cidv1 migration: ipfs/kubo#8185

The best we can do for CIDv0 is to improve error message when they get broken by a forced lowercase.
You can PR improvements against this line: https://github.com/ipfs/go-path/blob/v0.1.1/path.go#L187

@Atemu
Copy link

Atemu commented Sep 21, 2021

ipfs/go-path#45

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

3 participants