diff --git a/main.go b/main.go index dfea7f6..a0a07b1 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( "github.com/ipfs/go-cid" "github.com/libp2p/go-libp2p/core/peer" "github.com/multiformats/go-multiaddr" + "github.com/multiformats/go-multihash" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -108,8 +109,15 @@ func startServer(ctx context.Context, d *daemon, tcpListener, metricsUsername, m } cidKey, err := cid.Decode(cidStr) if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return + mh, mhErr := multihash.FromB58String(cidStr) + if mhErr != nil { + mh, mhErr = multihash.FromHexString(cidStr) + if mhErr != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + } + cidKey = cid.NewCidV1(cid.Raw, mh) } checkTimeout := defaultCheckTimeout diff --git a/web/index.html b/web/index.html index b1fdf52..2e758a1 100644 --- a/web/index.html +++ b/web/index.html @@ -25,7 +25,7 @@

- + @@ -273,7 +273,7 @@

What does it mean if I get an error?

outText += "IPNI\n" } } else { - outText += "❌ Could not find the multihash in DHR or IPNI\n" + outText += "❌ Could not find the multihash in DHT or IPNI\n" } if (respObj.DataAvailableOverBitswap.Error !== "") {