From e29cfedd56b5006a869b084ca4258d96f4a26735 Mon Sep 17 00:00:00 2001 From: nikitosing Date: Tue, 17 May 2022 19:28:37 +0300 Subject: [PATCH] Add regexp for ipfs checking --- CHANGELOG.md | 1 + .../block_scout_web/views/tokens/instance/overview_view.ex | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 501a38543b..4d26cebcce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - [#5540](https://github.com/blockscout/blockscout/pull/5540) - Tx page: scroll to selected tab's data ### Fixes +- [#5568](https://github.com/blockscout/blockscout/pull/5568) - Add regexp for ipfs checking - [#5564](https://github.com/blockscout/blockscout/pull/5564) - Add fallback clauses to `string_to_..._hash` functions - [#5538](https://github.com/blockscout/blockscout/pull/5538) - Fix internal transaction's tile bug diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex index 5e9776849a..2da0d1e63e 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex @@ -179,11 +179,11 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do defp compose_ipfs_url(image_url) do cond do - image_url =~ "ipfs://ipfs" -> + image_url =~ ~r/^ipfs:\/\/ipfs/ -> "ipfs://ipfs" <> ipfs_uid = image_url "https://ipfs.io/ipfs/" <> ipfs_uid - image_url =~ "ipfs://" -> + image_url =~ ~r/^ipfs:\/\// -> "ipfs://" <> ipfs_uid = image_url "https://ipfs.io/ipfs/" <> ipfs_uid