ipfs://CIDv0 (ipfs://Qm…) becomes lowercase and doesn't work on firefox 89 #1006
Description
When accessing ipfs://QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG, the link is converted to lowercase, and an error message appears because of that.
To Reproduce
- Install ipfs-companion 2.19.0 on Firefox 89 from https://addons.mozilla.org/en-US/firefox/addon/ipfs-companion/
- start
ipfs daemon
on the command-line - copy-paste this into the URL bar:
ipfs://QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG
- the url rapidly changes to
ipfs://qmuvtksryjpaxut7dr9fpkq6aokhhem7eg1zhgl56haklg
and then tohttps://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.
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
-
Entering https://dweb.link/ipfs/QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering ipfs://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering /ipfs/QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG in the URL bar works (and redirects to file:///ipfs/QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG)
-
Entering /ipfs/bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu in the URL bar works (and redirects to file:///ipfs/bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu)
-
Entering QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG.ipfs.localhost:8080 in the URL bar DOES NOT WORK (it gets redirected to http://qmuvtksryjpaxut7dr9fpkq6aokhhem7eg1zhgl56haklg.ipfs.localhost:8080/)
-
Entering bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080 in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering ipfs://ipfs/QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering ipfs://ipfs/bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering ipfs://./QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering ipfs://./bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering ipfs:./QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
-
Entering ipfs:./bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu in the URL bar works (and redirects to http://bafybeic3m55e3k75my22xepbnga5m7gao5dzvtwpnyjkebjqir54dlngfu.ipfs.localhost:8080/)
A similar issue has been reported in the past, and closed as fixed: #815
Activity
lidel commentedon 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 commentedon 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:
lidel commentedon 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 commentedon Sep 21, 2021
ipfs/go-path#45
ipfs://CIDv0
to case-insensitive CIDv1 before making the request little-bear-labs/ipfs-chromium#30