fix: Fix for metadata detection at ipfs protocol (#10646)

pull/10647/head
Victor Baranov 3 months ago committed by GitHub
parent 4d94d09ed8
commit 6bf68baee8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 14
      apps/explorer/lib/explorer/token/metadata_retriever.ex

@ -31,6 +31,7 @@
### 🐛 Bug Fixes
- Fix for metadata detection at ipfs protocol([#10646](https://github.com/blockscout/blockscout/pull/10646))
- Change default shrink internal_transactions table migration params ([#10644](https://github.com/blockscout/blockscout/pull/10644))
- Fix bug in update_replaced_transactions query ([#10634](https://github.com/blockscout/blockscout/issues/10634))
- Fix mode dependent processes starting ([#10641](https://github.com/blockscout/blockscout/issues/10641))

@ -579,14 +579,14 @@ defmodule Explorer.Token.MetadataRetriever do
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
defp fetch_from_ipfs?(token_uri_string, ipfs?, token_id, hex_token_id, from_base_uri?) do
case URI.parse(token_uri_string) do
%URI{scheme: "ipfs", path: path} ->
%URI{scheme: "ipfs", host: host, path: path} ->
resource_id =
case path do
"/ipfs/" <> resource_id ->
resource_id
"/" <> resource_id ->
resource_id
if host == "ipfs" do
"/" <> resource_id = path
resource_id
else
# credo:disable-for-next-line
if is_nil(path), do: host, else: host <> path
end
fetch_from_ipfs(resource_id, hex_token_id)

Loading…
Cancel
Save